Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

closed source library includes boost distribution

I'm using a closed source library (by Activ financial) that includes with their API a boost distribution, both some boost header files and boost library files.

I also use Boost in my existing codebase, and I need to use Activ from my existing code.

Some points

  • I can encapsulate my use of Activ so that the entire Activ part amounts to a single class I wrote that does not expose any of Activ's headers
  • This single header file does not use any boost anything
  • In this way I can ensure that the Activ parts of my code use Activ's Boost HPP files, and my code uses my Boost's HPP files

My worry comes in linking. How can I ensure that my Activ dependent code links to Activ's Boost, and my other code links to my Boost?

I'm using g++ now, will also be doing this in VS2008. I got it working in VS2008 before, but I have no idea how everything linked. I want to try to make sure it's done correctly.

Is there a way to do it without further encapsulating the Activ part in a dynamic library?

Edit:

For one, my final product is always an executable file. For two, I statically link to boost myself. The Activ library includes both static and dynamic versions of Boost object libraries, and I plan to statically link it.

I never pass Boost objects between code that uses different boost versions.

The question is, how do I link one cpp or .o file to objects in one library file, and then make sure other .o files link to the identical objects in another library file? Is this possible?

like image 941
Scott Avatar asked Dec 01 '10 06:12

Scott


People also ask

Is boost open source?

Boost is licensed under its own free, open-source license, known as the Boost Software License.


1 Answers

Does the library dynamically or statically link to Boost? If statically linked, does the library expose the symbols in the DLL (declspec export)?

If the library is statically linked and the symbols are not exposed, and you do not pass any Boost data structures (smart_ptr, threads, etc) back and forth, you are likely safe to use your own version of the Boost library in your DLL.

like image 112
Yann Ramin Avatar answered Sep 22 '22 05:09

Yann Ramin