mahonya
mahonya

Reputation: 10055

how can I use static library build by different version of mingw?

Greetings, I am facing a complicated situation about using a static library under windows. The static library is build by a specific version of mingw which is bundled with Eiffel studio. Since Eiffel studio uses mingw to create its output as a static lib, I have no control over this configuration. If I try to use this static library with Eclipse CDT which is using a more recent version of mingw, then I can't compile my project. This is because I have to provide -l options to various libraries like winsock, and it appears due to difference between versions of compilers generating static library and my code, this does not work.

If I force Eclipse to use the same mingw directory that comes with Eiffel studio, the one that compiled the static lib, then I can compile my code (there are some other issues here though) I do not want to constrain my c++ development just because a static library is build with a particular version of mingw.

So how can I use this static library from my own mingw version? This is windows xp btw..

Best Regards Seref

Upvotes: 0

Views: 829

Answers (1)

INS
INS

Reputation: 10820

Though I don't have a lot of information here is what I would do:

  1. Try to compile with the newer version of mingw and see if you can make it work. Errors are very important in this case (you should check also the mingw manual/mailing lists/forums for finding about the compatibility between mingw versions

  2. Separate the library from the program and wrap all its functionality - to avoid different incompatible compilation flags (you could create a different library - even a DLL and call your new functions (wrappers for some library functions)

  3. Decide what part of the project is mandatory - the part with the library or the rest of the code

    1. If the library is mandatory I would compile the code with that version of mingw
    2. Else I would try to find an equivalent for that library or eliminate it

Others option may be available but this is what I would do (in this order)

Upvotes: 1

Related Questions