lists.zerezo.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** Re: [Mingw-users] trouble converting a MSVC lib



Christopher Harvey wrote:

> I've read the tutorials that explain how to do this but I'm stuck now.
> Basically I've got 3 files, and no source:
> NPRigidBody.dll
> NPRigidBody.h
> NPRigidBody.lib
> 
> I copied these into an empty folder then opened up a prompt and ran:
> 
> pexports NPRigidBody.dll | sed "s/^_//" > NPRigidBody.def

Why did you do this?  You already have an import library in the form of
NPRigidBody.lib.

> I got this link error:
> Application.o:Application.cc:(.text+0x18c9): undefined reference to
> `_imp___Z22RB_InitializeRigidBodyv'
> Application.o:Application.cc:(.text+0x1b09): undefined reference to
> `_imp___Z22RB_InitializeRigidBodyv'

These symbols have been mangled, meaning they have C++ linkage, meaning
the header did not declare them 'extern "C"'.  If they really have C
linkage then you need to either a) compile your source with a C compiler
and not a C++ compiler, or b) edit the header so that they are declared
'extern "C"'.

Note that the above assumes the library is a C library and you are using
a C++ compiler.  If the library is a C++ library and was built with MSVC
then just stop now, it's not going to work.  C++ binary compatibility
across different vendor compilers is not something that you can
generally expect to work.

> and tried both those output files. The program linked, but at runtime I get:
> "The procedure entry point _imp__Z22RB_InitializeRigidBodyv could not
> be located in the dynamic link library NPRigidBody.dll"

Right, because you lied in the .def file telling the linker that a
symbol exists that does not -- that's not going to work.

Brian

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users