Operating System - HP-UX
1844208 Members
2290 Online
110229 Solutions
New Discussion

How do I create an Archive/Static library from Shared/Dynamic library

 
Kevin Bingham
Regular Advisor

How do I create an Archive/Static library from Shared/Dynamic library

Hi Everyone,

I was not sure which forum to place this in so I opted for General (feel free to move it if appropiate).

I have the following problem:
We create software that utilizes C++, Oracle and some libraries from a 3rd party. The software functions from the 3rd party is supplied in "shared" lib*.sl format. Due to the need to "future proof" our customers against them needing the same release of these 3rd party libraries (they have their release in their name), I need to be able to statically/archive link those functions into our resulting load modules. So, here's the question...

How can I create a static/archive library for use in my links when all I have is the shared/dynamic library to work with?

Any reasonable solution would be greatly appreciated...

Thanks in advance.
Kevin
6 REPLIES 6
ranganath ramachandra
Esteemed Contributor

Re: How do I create an Archive/Static library from Shared/Dynamic library

there is no way to do this. it would require a new tool which could be interesting tp build, but i'm not sure what you would get at the end of the execise.
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo

Arunvijai_4
Honored Contributor

Re: How do I create an Archive/Static library from Shared/Dynamic library

You can't do it. Shared library is just like an executable from which is impossible to extract .o files and build a archive library.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Jean-Luc Oudart
Honored Contributor

Re: How do I create an Archive/Static library from Shared/Dynamic library

Kevin,

what do you want to achieve exactly ?

If you want to use a specific module instead of the one in the shared library, you can specify the order to find a module.

Regards
Jean-Luc
fiat lux
Kevin Bingham
Regular Advisor

Re: How do I create an Archive/Static library from Shared/Dynamic library

Hi

As I tried to explain, I need to make our software independent from the software that a customer might be running. Typically, our customers will have the same (or similar) software for development as us, and I would like to statically link in the 3rd party (Dev Tool) libraries so that I can guarantee that our software works with the patch level (from the 3rd party) that we test with, and therefore not be affected by the customer having a different patch level. The 3rd party ships it's software with lib*.sl libraries, and these may or may not be affected/updated by a patch.

I hope that makes my requirement a bit clearer.

Kevin
Jean-Luc Oudart
Honored Contributor

Re: How do I create an Archive/Static library from Shared/Dynamic library

Kevin

What about forcing the use of these specific shared libraries with chatr command (man chatr) or use the SHLIB_PATH enabled and 1st pointing the 3rd party lib location (your version)

man chatr

I believe you can check with lsof which libraries are opened by a specific process.

Regards
Jean-Luc
fiat lux
Kevin Bingham
Regular Advisor

Re: How do I create an Archive/Static library from Shared/Dynamic library

Hi,

That is a partial work around to the problem. Sometimes a customer will be using a completely different release of the 3rd party software and therefore the library names will not match at all, so in those cases we have to ship copies of the ones we have, but it would be better if we could solve all the problems in a single solution by statically linking these libraries.

Kevin