DCSIMG
Native API,Interop - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

Dealing With Native DLLs in .NET “AnyCPU” Builds
13 February 11 09:27 PM | pavely | 2 comment(s)
A .NET application can be compiled using the “AnyCPU” configuration, meaning the application runs as 32 bit on a 32 bit OS, and 64 on a 64 bit OS. As long as the application is purely managed, everything should be just fine. However, if the application must use some native DLL through interop (e.g. P/Invoke), then “AnyCPU” may be an issue. A native DLL cannot be both 32 and 64 bit – it’s one or the other. The traditional solution to the problem is to switch the .NET build to a “Win32” or “x64” configuration...