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

Posted by Daren Thomas on Stack Overflow See other posts from Stack Overflow or by Daren Thomas
Published on 2010-06-17T09:37:41Z Indexed on 2010/06/17 9:43 UTC
Read the original article Hit count: 379

I have a DLL written in C in source code. This is the code for the General Polygon Clipper (in case you are interested). I'm using it in a C# project via the C# wrapper provided on the homepage. This comes with a precompiled DLL.

Since switching to a 64bit Development machine with Visual Studio 2010 and Windows 7 64 bit, the application won't run anymore. This is the error I get:

An attempt was made to load a program with an incorrect format.

This is because of DLLImporting the 32bit gpc.dll, as I have gathered from stuff found on the web.

I assume this will all go away if I recompile the DLL to 64bit, but can't for the love of me figure out how to do so. My C skills are basic, in that I can write a C program with the GNU tools, but have no experience with various compilers / processors / IDEs etc.

I believe I could port this to C#. By that I mean I trust myself to actually pull it off. But I'd prefer not to, since it is a lot of work that I'd prefer a compiler to do for me ;)

© Stack Overflow or respective owner

Related posts about c

    Related posts about visual-studio-2010