Jump to content
  • Advertisement
Sign in to follow this  
rldivide

re-using compiled libraries

This topic is 2348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I was provided a library (visual studio project) and I want to use it in my Qt(MingW,gcc) project.

The problem is:

-The library headers only compile on visual studio, because they include some visual studio specific headers for some stuff.
Is it safe to create a clean header for my Qt project declaring only the functions I need, leaving all the other useless or VS related stuff I don't need ?

-Using a VS compiled library (.lib) with Qt/MingW,gcc: will it be able to find the functions name inside the compiled library ? I'm afraid VS and MingW use different naming conventions. If the problem occurs, is there a workaround ?

thanks !

source header:

#include <uselessstuff>
#include <VSspecificstuff>

[color=#000000][font=verdana, geneva, lucida,]A();[/font]

[color=#000000][font=verdana, geneva, lucida,]class B {[/font]
[color=#000000][font=verdana, geneva, lucida,]B();[/font]
[color=#000000][font=verdana, geneva, lucida,]B1();[/font]
[color=#000000][font=verdana, geneva, lucida,]B2();[/font]
[color=#000000][font=verdana, geneva, lucida,]}[/font]

[color=#000000][font=verdana, geneva, lucida,]class C {[/font]
[color=#000000][font=verdana, geneva, lucida,]C();[/font]
[color=#000000][font=verdana, geneva, lucida,]C1();[/font]
[color=#000000][font=verdana, geneva, lucida,]C2();[/font]
[color=#000000][font=verdana, geneva, lucida,]}[/font]

[color=#000000][font=verdana, geneva, lucida,]D();[/font]

wished header:

[color=#000000][font=verdana, geneva, lucida,]class B {[/font]
[color=#000000][font=verdana, geneva, lucida,]B();[/font]
[color=#000000][font=verdana, geneva, lucida,]B1();[/font]
[color=#000000][font=verdana, geneva, lucida,]B2();[/font]
[color=#000000][font=verdana, geneva, lucida,]}[/font]

Share this post


Link to post
Share on other sites
Advertisement

I was provided a library (visual studio project) and I want to use it in my Qt(MingW,gcc) project.

The problem is:

-The library headers only compile on visual studio, because they include some visual studio specific headers for some stuff.
Is it safe to create a clean header for my Qt project declaring only the functions I need, leaving all the other useless or VS related stuff I don't need ?

-Using a VS compiled library (.lib) with Qt/MingW,gcc: will it be able to find the functions name inside the compiled library ? I'm afraid VS and MingW use different naming conventions. If the problem occurs, is there a workaround ?

It's possible that the headers you;re talking about are not Visual Studio headers (which really, to me, makes no sense) but are Windows SDK headers. You can probably find those headers from MinGW/GCC and compile the library that way. that's your best bet.

If your library binary was compiled using the Microsoft Visual C++ compiler, it's unlikely that you will be able to link it to objects compiled with GCC's C++ compiler because of C++ runtime ABI mismatch issues, not to mention name mangling.

If your library binary was compiled with Microsoft Visual C, it's possible to use C linkage instead, and the problem may not exist. Experiment.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!