Can't link with DLL.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't link with DLL.

Леонид Чайка
Can't link with DLL.
I thought mingw can link directly with DLL. (and it works on other project)
Please give any link how to resolve this issue.

I get *.def files for one DLL witch works and current one that not.
WORKS:
LIBRARY     HGE.DLL

EXPORTS
   hgeCreate                      @1   ; hgeCreate
   hgeCreate                      @2   ; hgeCreate

NOT WORKS:
LIBRARY     PYRO.DLL

EXPORTS
   ??0CPyroException@PyroParticles@@QAA@PBDZZ @1   ;
??0CPyroException@PyroParticles@@QAA@PBDZZ
   ??0CPyroException@PyroParticles@@QAE@ABV01@@Z @2   ;
??0CPyroException@PyroParticles@@QAE@ABV01@@Z
   ??0CPyroException@PyroParticles@@QAE@PAD@Z @3   ;
??0CPyroException@PyroParticles@@QAE@PAD@Z
   ??0CPyroException@PyroParticles@@QAE@XZ @4   ;
??0CPyroException@PyroParticles@@QAE@XZ
   ??1CPyroException@PyroParticles@@QAE@XZ @5   ;
??1CPyroException@PyroParticles@@QAE@XZ
   ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
@6   ; ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
   ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
@7   ;
?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
   ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ @8   ;
?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ

Any help?

If you want to see DLL I can attach it, just ask.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't link with DLL.

Marc Vaillant
What exactly are you trying to do?  It looks like you are trying to link
a DLL from another compiler (visual c++) into an MINGW program?  Your
first DLL has C name mangling and your second is C++ which I think is
your problem.  If you want to use C++ DLL, your interfaces need to
follow the following:

http://aegisknight.org/cppinterface.html

Marc

On Mon, Oct 27, 2008 at 02:53:35PM +0200, Леонид Чайка wrote:

> Can't link with DLL.
> I thought mingw can link directly with DLL. (and it works on other project)
> Please give any link how to resolve this issue.
>
> I get *.def files for one DLL witch works and current one that not.
> WORKS:
> LIBRARY     HGE.DLL
>
> EXPORTS
>    hgeCreate                      @1   ; hgeCreate
>    hgeCreate                      @2   ; hgeCreate
>
> NOT WORKS:
> LIBRARY     PYRO.DLL
>
> EXPORTS
>    ??0CPyroException@PyroParticles@@QAA@PBDZZ @1   ;
> ??0CPyroException@PyroParticles@@QAA@PBDZZ
>    ??0CPyroException@PyroParticles@@QAE@ABV01@@Z @2   ;
> ??0CPyroException@PyroParticles@@QAE@ABV01@@Z
>    ??0CPyroException@PyroParticles@@QAE@PAD@Z @3   ;
> ??0CPyroException@PyroParticles@@QAE@PAD@Z
>    ??0CPyroException@PyroParticles@@QAE@XZ @4   ;
> ??0CPyroException@PyroParticles@@QAE@XZ
>    ??1CPyroException@PyroParticles@@QAE@XZ @5   ;
> ??1CPyroException@PyroParticles@@QAE@XZ
>    ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
> @6   ; ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
>    ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
> @7   ;
> ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
>    ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ @8   ;
> ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ
>
> Any help?
>
> If you want to see DLL I can attach it, just ask.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't link with DLL.

Леонид Чайка
I have library: heder file, lib file and DLL. - no source code.
I try to use this library in my application.

Interface:
#ifndef _PYRO_H_INCLUDED
#define _PYRO_H_INCLUDED

#if defined(_MSC_VER) && (_MSC_VER > 1000)
#pragma once
#endif /* _MSC_VER > 1000 */

#if defined(WIN32) && !defined(PYROLIB_STATIC)

#ifdef PYROLIB_COMPILATION
#define PYROAPI __declspec(dllimport)
#else
#define PYROAPI __declspec(dllexport)
#endif

#else
#define PYROAPI
#endif

#define PYRO_MAKE_VERSION(Major, MinorHi,  MinorLo)   (((Major) << 16) |
((MinorHi) << 8) | (MinorLo))

#define PYRO_SDK_VERSION    PYRO_MAKE_VERSION(1, 1, 9)

#include "PyroTypes.h"
#include "PyroGraphics.h"
#include "PyroInterfaces.h"

PyroParticles::IPyroParticleLibrary PYROAPI
*CreateParticleLibrary(PyroDWord Version);

void PYROAPI DestroyParticleLibrary(PyroParticles::IPyroParticleLibrary
*pParticleLibrary);

#endif /* _PYRO_H_INCLUDED */

If I change it I still can't rebuild DLL so I don't know how to link
with DLL.


Marc Vaillant пишет:

> What exactly are you trying to do?  It looks like you are trying to link
> a DLL from another compiler (visual c++) into an MINGW program?  Your
> first DLL has C name mangling and your second is C++ which I think is
> your problem.  If you want to use C++ DLL, your interfaces need to
> follow the following:
>
> http://aegisknight.org/cppinterface.html
>
> Marc
>
> On Mon, Oct 27, 2008 at 02:53:35PM +0200, Леонид Чайка wrote:
>  
>> Can't link with DLL.
>> I thought mingw can link directly with DLL. (and it works on other project)
>> Please give any link how to resolve this issue.
>>
>> I get *.def files for one DLL witch works and current one that not.
>> WORKS:
>> LIBRARY     HGE.DLL
>>
>> EXPORTS
>>    hgeCreate                      @1   ; hgeCreate
>>    hgeCreate                      @2   ; hgeCreate
>>
>> NOT WORKS:
>> LIBRARY     PYRO.DLL
>>
>> EXPORTS
>>    ??0CPyroException@PyroParticles@@QAA@PBDZZ @1   ;
>> ??0CPyroException@PyroParticles@@QAA@PBDZZ
>>    ??0CPyroException@PyroParticles@@QAE@ABV01@@Z @2   ;
>> ??0CPyroException@PyroParticles@@QAE@ABV01@@Z
>>    ??0CPyroException@PyroParticles@@QAE@PAD@Z @3   ;
>> ??0CPyroException@PyroParticles@@QAE@PAD@Z
>>    ??0CPyroException@PyroParticles@@QAE@XZ @4   ;
>> ??0CPyroException@PyroParticles@@QAE@XZ
>>    ??1CPyroException@PyroParticles@@QAE@XZ @5   ;
>> ??1CPyroException@PyroParticles@@QAE@XZ
>>    ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
>> @6   ; ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
>>    ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
>> @7   ;
>> ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
>>    ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ @8   ;
>> ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ
>>
>> Any help?
>>
>> If you want to see DLL I can attach it, just ask.
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> MinGW-users mailing list
>> [hidden email]
>>
>> You may change your MinGW Account Options or unsubscribe at:
>> https://lists.sourceforge.net/lists/listinfo/mingw-users
>>    
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>  


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't link with DLL.

Marc Vaillant
On Tue, Oct 28, 2008 at 10:52:30AM +0200, Леонид Чайка wrote:

> I have library: heder file, lib file and DLL. - no source code.
> I try to use this library in my application.
>
>
> #include "PyroTypes.h"
> #include "PyroGraphics.h"
> #include "PyroInterfaces.h"
>
> PyroParticles::IPyroParticleLibrary PYROAPI
> *CreateParticleLibrary(PyroDWord Version);
>
> void PYROAPI DestroyParticleLibrary(PyroParticles::IPyroParticleLibrary
> *pParticleLibrary);
>
> #endif /* _PYRO_H_INCLUDED */
>

From your Export table below, it looks like there are some other exports,
PyroException?  Anyway, your first problem is the namespace.  You need C
linkage which means no namespaces.  Secondly, you need to check that
the IPyroParticleLibrary class contains only virtual methods (among
other things).  If that is the case, then you are not in too bad shape:
it's a simple matter of writing a thin DLL wrapper (that removes the
namespaces)  around these exported methods in the native compiler of the
original DLL.  You thin DLL wrapper is then what you want to link to.
Again, read http://aegisknight.org/cppinterface.html
carefully for details.

> >> EXPORTS
> >>    ??0CPyroException@PyroParticles@@QAA@PBDZZ @1   ;
> >> ??0CPyroException@PyroParticles@@QAA@PBDZZ
> >>    ??0CPyroException@PyroParticles@@QAE@ABV01@@Z @2   ;
> >> ??0CPyroException@PyroParticles@@QAE@ABV01@@Z
> >>    ??0CPyroException@PyroParticles@@QAE@PAD@Z @3   ;
> >> ??0CPyroException@PyroParticles@@QAE@PAD@Z
> >>    ??0CPyroException@PyroParticles@@QAE@XZ @4   ;
> >> ??0CPyroException@PyroParticles@@QAE@XZ
> >>    ??1CPyroException@PyroParticles@@QAE@XZ @5   ;
> >> ??1CPyroException@PyroParticles@@QAE@XZ
> >>    ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
> >> @6   ; ?CreateParticleLibrary@@YAPAVIPyroParticleLibrary@PyroParticles@@I@Z
> >>    ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
> >> @7   ;
> >> ?DestroyParticleLibrary@@YAXPAVIPyroParticleLibrary@PyroParticles@@@Z
> >>    ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ @8   ;
> >> ?GetExceptionMessage@CPyroException@PyroParticles@@QBEPBDXZ
> >>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

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