brian
brian

Reputation: 133

How to create self-contained shared library

I have a dependency problem. Library A depends on dynamic library B and C. But B depends on D ver1, while C depends on D ver2. I do not have the source for C.

How can I create a self-contained shared library containing C and D ver1, such that A can link to this new library, B, and D ver 1, and therefore avoid a conflict between D ver1 and D ver2?

Upvotes: 0

Views: 301

Answers (2)

Ralph Allan Rice
Ralph Allan Rice

Reputation: 402

You mentioned that you do not have the source of library C, but what about library A and library B? If you have those sources, update library B to depend on library D ver2 instead of library D ver1?

I would also consider merging library A and B. That would remove the dependency diamond. If you can duplicate the functionality of C, then you bring it down to a simple singular dependency on D ver2.

Upvotes: 1

Jesper Juhl
Jesper Juhl

Reputation: 31458

You can statically link your dependencies - is one option. Or you could just stop being fixated on shipping a "self contained" library and ship your dependencies along with it. What bother is a few extra files?

Upvotes: 0

Related Questions