2

Sorry for the confusing wording.

Basically I want to create a static library (libone.a) that needs to link another static library (libtwo.a). libone.a and libtwo.a are both linked in statically into another program (let's call it program) by doing the following:

$(CC) -o program something.o anotherthing.o -L/path/to/lib -lone -ltwo

Whenever program makes a call to a method in libtwo.a it should go to the libtwo.a that is loaded with program. But whenever program makes a call to a method in libone.a which calls a method in libtwo.a, it should call the libtwo.a that was embedded in when libone.a was created. Yes I understand that this will blow up the file size by loading two of the same libraries but I'm OK with that.

The reason why I'm attempting this is because the program I have is using OpenSSL (in this case libcrypto.a) and my static library is also using libcrypto. However I have a requirement in my library that OpenSSL be FIPS valid (i.e. FIPS_mode_set(1)) but doing that will break program. In short I want to libraries of OpenSSL used. The one called by program natively should use its own and the one called by my library should use the one that I linked and is FIPS valid.

Is this possible?

1 Answers1

1

Is this possible?

No, this simply can not be done with archive libraries (it can be done with shared libraries but requires great care to avoid symbol collisions).

Employed Russian
  • 199,314
  • 34
  • 295
  • 362