From: Usman on
Hi

I'm working on an application that works with Sql server for
creation/deletion/backup/restore of database. The code works fine on a 32
bit machine, but CreateInstance fails on a 64 bit platform with a runtime
exception "R6034. An application has made an attempt to load the C runtime
library incorrectly. Please contact the application support team for more
information". Does anyone have any idea what am I doing wrong here for 64
bit machines.

#import "C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\Resources\1033\sqldmo.rll" rename("Application",
"Application1") rename("Properties", "Properties1") rename("Property",
"Property1") no_namespace

int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
_SQLServerPtr spSQLServer;

if (SUCCEEDED(spSQLServer.CreateInstance(__uuidof(SQLServer))))
{
MessageBox(NULL, "success", 0, 0);
}
else
{
MessageBox(NULL, "failed", 0, 0);
}

return 0;
}




From: Michael Coles on
Just a guess, but you may need to build your app with a manifest. See here:
http://msdn.microsoft.com/en-us/library/ms235560(VS.80).aspx

--

========
Michael Coles
"Pro SQL Server 2008 XML"
http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/


"Usman" <usman(a)hostingcontroller.com> wrote in message
news:ebi044c3IHA.3384(a)TK2MSFTNGP04.phx.gbl...
> Hi
>
> I'm working on an application that works with Sql server for
> creation/deletion/backup/restore of database. The code works fine on a 32
> bit machine, but CreateInstance fails on a 64 bit platform with a runtime
> exception "R6034. An application has made an attempt to load the C runtime
> library incorrectly. Please contact the application support team for more
> information". Does anyone have any idea what am I doing wrong here for 64
> bit machines.
>
> #import "C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\Resources\1033\sqldmo.rll" rename("Application",
> "Application1") rename("Properties", "Properties1") rename("Property",
> "Property1") no_namespace
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> CoInitialize(NULL);
> _SQLServerPtr spSQLServer;
>
> if (SUCCEEDED(spSQLServer.CreateInstance(__uuidof(SQLServer))))
> {
> MessageBox(NULL, "success", 0, 0);
> }
> else
> {
> MessageBox(NULL, "failed", 0, 0);
> }
>
> return 0;
> }
>
>
>
>