How to compile C DLL for 64-bit version with Visual Studio 2010?

I have a dll written in C in the source code. This is the General Polygon Clipper code (if you're interested). I use it in a C # project through the C # shell presented on the main page. This is due to the precompiled DLL.

Since the transition to a 64-bit development machine with Visual Studio 2010 and Windows 7 is 64 bit, the application will no longer work. This is the error I get:

An attempt was made to download a program with the wrong format.

This is due to DLLImport with the 32-bit gpc.dll , as I have compiled from materials found on the Internet.

I assume that all this will disappear if I recompile the DLL to 64-bit, but I can not, because love for me figures out how to do this. My C skills are basic, as I can write a C program using GNU tools, but I have no experience with various compilers / processors / IDEs, etc.

I believe I could pass this to C #. By this, I mean that I trust myself to actually remove this. But I would prefer not to do this, as this is a lot of work that I would rather do for me as a compiler;)

+6
c visual-studio-2010 32bit-64bit dllimport
source share
1 answer

It can be as simple as creating a new platform:

  • open project properties pages (ALT + ENTER)
  • select x64 platform in the drop-down menu in the upper right corner
    • If the platform does not exist yet, create a new one.
  • rebuild
    • make sure you check the correct artifacts when building, since now you probably have a different output directory.
+5
source share

All Articles