开发者

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

开发者 https://www.devze.com 2023-01-04 06:44 出处:网络
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

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 wri开发者_如何学编程te 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 ;)


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消