One of our applications is located in C # /. NET 1.1 / VS2003 and should remain as follows: - (
I need to use the code from another C # assembly that is in .NET 2.0: due to technical limitations (.NET 1.1 is required, so using .NET 2.0 directly is not possible), I deleted the code from the .NET 2.0 project to try to adapt it to .NET 1.1 (not easy, since there are no generics, partially forbidden, etc.).
My 1.1 code is now compiling, but not executing at runtime due to EntryPointNotFoundException due to P / Invoke in an unmanaged DLL.
What is strange is that I first tried to check my changes in .NET 2.0, and I have no problem importing the DLL:
[DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFileTypeFromHandle")] public static extern FREE_IMAGE_FORMAT GetFileTypeFromHandle(ref FreeImageIO io, fi_handle handle, int size);
In both projects, the declaration is the same, of course, the DLL, too. dumpbin.exe gives for signature:
_FreeImage_GetFileTypeFromHandle@12
I also tried to declare an entry point with this name, but this also does not work, and also desperately trying to change CallingConvention , CharSet , ExactSpelling ... No !!
This can happen either:
due to a change in the way DllImport works between .NET 1.1 and 2.0, but I did not find anything that happens this way
due to the error of my porting code from .NET 2.0 to 1.1, but I donβt see how it could be exact in this case (I even tracked the code to see the sizes of the arguments, io and handle , in both cases they are the same)
... that I cannot think of!
Thanks so much for your experience!