lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: [Mingw-users] trouble converting a MSVC lib
- Date: Wed, 18 Jun 2008 22:30:51 -0400
- From: Christopher Harvey <arbuckle911@xxxxxxxxx>
- Subject: ***BOGO*** Re: [Mingw-users] trouble converting a MSVC lib
Brian Dessent wrote:
> 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 did it because I only have a vague idea of how to do this.
>
>> 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"'.
>
I can't use a C compiler so a is not an option. When you said "edit your
header", do you mean, "edit your header and re-compile the dll" or did
you mean "edit your header and recompile the application that is calling
the dll"? I can't say if it's a C or C++ dll, but one thing is for sure
all the functions are C compatible.
> 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
>
Thanks for the reply.
> -------------------------------------------------------------------------
> 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
>
>
-------------------------------------------------------------------------
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