views:

117

answers:

1

I know that platform agnostic .NET applications "float up" to the bitness of the operating system. But what about a .NET assembly that is a library, not an executable, being called from a non-.NET application?

We have a .NET DLL that is a CLR extended stored procedure for SQL Server 2005. Currently it is platform agnostic. What happens when the extended stored procedure is invoked from a 32 bit SQL Server instance running on 64 bit Windows?

+1  A: 

It depends on what target the assembly was compiled for. If you selected "Any CPU" or "x86" in the project build options the DLL should run as 32 bit instance. If you selected "x64" it will throw an exception (BadImageFormatException from memory).

Under Windows 32 bit processes can't load 64 bit DLLs so SQL Server will be running a 32 bit version of the .net runtime inside its process. So your .net assembly will also run as 32 bit even on a 64 bit machine.

Luke Quinane