With WINAPI I get a bunch of compilation errors. Like I said in one of my previous posts, I got it to work w/ P/Invoke. Since performance is not relly an issue in my case, I can live with that. Regards and thanks, Eddie
-----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of J. Merrill Sent: Thursday, July 20, 2006 12:45 PM To: [email protected] Subject: Re: [ADVANCED-DOTNET] Linking an unmanaged C++ .dll in a VS.NET 2005 Managed C++ Class Library The vendor's original header file indicated that the code uses the Pascal calling convention. Your change told MC++ that it uses the default (cdecl) calling convention. When you made a call to ObjectCreate, the compiler thought you wanted to call the method using cdecl, and put that info where the linker saw it. The linker correctly determined that the DLL has no such method -- the method with that name in the DLL is using the Pascal calling convention. (It would have been nice had the linker told you that there's a method in the DLL that has the name ObjectCreate but it uses the Pascal calling convention!) Try changing "pascal" to "WINAPI" in the header file and try again. This page http://msdn2.microsoft.com/en-us/library/wda6h6df.aspx suggests that this will fix things for you. At 08:53 AM 7/20/2006, Eddie Lascu wrote >Yes, it is true, I have two header files - one containing types and the >other one with the declaration of all the methods in the interface of the >API. >The change that I made in one header file was this (commented line is what >was there before): > >#if defined(WIN32) >#define EXPORTENTRY __declspec(dllexport) >//#define EXPORTENTRY __declspec(dllexport) pascal >#else >#define EXPORTENTRY >#endif > >I will read your suggestion and will try to see if I can get a >VS2005-generated lib file. > >Thanks, >Eddie >[snip] J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
