8

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 ;)

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200

1 Answers1

8

It could be as easy as creating a new platform:

  • open property pages of project (ALT+ENTER)
  • choose platform x64 in dropdown menu in top-right corner
    • if the platform does not already exist, create a new one
  • rebuild
    • make sure you are checking the right artefacts when built, as you now probably have a different output directory.
Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
  • 1
    The platform x64 doesn't exist, how do I create a new one? I have a C++/MFC project in VS2010. I couldn't find platform x64 or 0x86 anywhere in the project settings. – zar Aug 10 '12 at 15:34
  • With Visual Studio 2010 Express, 64 bits SDK is not included. You need to [download it separately and install it](http://www.microsoft.com/en-us/download/details.aspx?id=8279). I had too many issues with it and was actually able to have a correct installation on one computer, by accident. Since then, I'm unable to repeat an installation from scratch. I'll check GCC (which I think now works better than Visual compiler). – Matthieu Mar 13 '14 at 14:25