Convert dynamic lib to static lib

Sisyphus kalinabears@iinet.net.au
Fri Oct 15 22:56:00 GMT 2004


Eljay Love-Jensen wrote:
> Hi Rob,
> 
> I don't know of any way to make a dynamically linked library (.dll or 
> .so) into a statically linked archive library (.lib or .a).
> 
> I believe you'll have to recompile the source of the two .dll's (or at 
> minimum, ar together the .o files - presuming there's no DLL 
> instrumentation that happens to the object files at compile time) as an 
> archive library instead of a shared library.
>

I found that I could extract the object files from the 2 '.a' files 
(with 'ar x') and then re-archive those object files with 'ar rc' ... 
but that just gets me back to where I started, and the dll's are still 
needed at runtime.

I'll have a crack at building a static library from source.

Thanks Eljay.

The folowing is superfluous and waaaay OT, but if anyone wants to offer 
some thoughts, they're welcome.

The project is to get the perl module 'PGPLOT-2.18' built. It actually 
compiles fine, but when I come to use it, I immediately get the fatal 
error that a particular "procedure entry point" in the pgplot.dll could 
not be found. I thought that if I could build the perl module against a 
static build of pgplot then, if the problem did not go away, it might 
present itself as something I knew how to deal with .... for I have 
absolutely no idea of how to deal with this current manifestation :-)

When I build C apps against this pgplot shared library, there is 
absolutely no problem .... so it's something in the PGPLOT-2.18 perl 
source that's triggering the problem. I've spent hours hacking at the 
source, trying to locate a cause for the error, but it still eludes me.

 From what I can gather, the complaint that the "procedure entry point 
for foo could not be found" is just telling me that the "foo" function 
aint in the dll, but it was expected to be there. But this particular 
"foo" isn't even mentioned in the perl module source.

I've tried contacting both the author of the perl module and the builder 
of the pgplot shared library - but neither has replied (as is their right).

So near and yet so far ....

Cheers,
Rob



More information about the Gcc-help mailing list