Unable to find an entry point named 'FreeImage_GetFileTypeU' in DLL 'FreeImageNET'

StackOverflow https://stackoverflow.com/questions/13322969

  •  28-11-2021
  •  | 
  •  

سؤال

I just downloaded FreeImage 3.15.4 Win32 and I'm trying to go through their C# samples. I have a 64-bit Windows 7 machine with Visual Studio Express 2010, so I recompiled the samples to 64 bit as described here (http://www.sambeauvois.be/blog/2010/05/freeimage-and-x64-projects-yes-you-can/). I also had to change the name of the "FreeImageLibrary" string in FreeImageStaticImports.cs in order to get the sample applications to start (the produced DLL was named FreeImageNet and not FreeImage as the samples expected).

However when I run the samples, I get an "Unable to find an entry point named 'FreeImage_GetFileTypeU' in DLL 'FreeImageNET'." error whenever I call a FreeImage function. The samples reference the library that contains the DLLImport statements, so I'm not really sure what's broken here. Does anyone have experience with FreeImage and C# that could offer some advice? Thanks!

هل كانت مفيدة؟

المحلول

I also had to change the name of the "FreeImageLibrary" string

That's how you got into this trouble. There are two DLLs involved here. FreeImage.dll is the native DLL, it contains the FreeImage_GetFileTypeU export. FreeImageNET.dll is the managed class library that contains the wrappers for the native DLL, it doesn't have that export as the exception message told you.

What you should have done was rebuild the native DLL from source so that you got the 64-bit version of FreeImage.dll. That blog post told you how to do that. And offered a download, ymmv.

It must also be copied into the build output folder so that it can be found at runtime. An easy way to do that is to add it to your project with Project + Add Existing Item and set its "Copy to Output Directory" property to "Copy if newer".

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top