libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about static and shared libraries and their usage in a bina


From: Nick Bowler
Subject: Re: Question about static and shared libraries and their usage in a binary on Windows in a autotools project
Date: Tue, 10 Aug 2021 17:19:39 -0400

On 2021-08-10, Vincent Torri <vincent.torri@gmail.com> wrote:
[...]
> As I have said, the problem is not the lib itself. There is no problem
> with the lib. The problem is with the binary : when I compile it,
> there is no way to know if the library, that the binary uses, is a
> static library or shared library (know == having a macro to
> distinguish shared lib and static lib)

I'm not too familiar with shared libraries on Windows, but I think
mingw solves this particular problem by generating static wrapper libs
with stub functions that then call the real implementation in the dll.

With such a wrapper, I suppose there is no difference (from the program's
perspective) between linking against the real static archive versus
linking against the wrapper.  When using mingw and libtool simple
libraries appear to "just work" at least.

Without such a wrapper I suppose you will need to know at compile time
which libraries will be used in the future at link time.  I don't think
libtool can make any assumptions here in general, as link options are
not typically passed to compile mode commands (and in fact, many libtool
options are overloaded to mean different things depending on whether you
are running it in compile or link mode).

It all seems very annoying indeed.  I wonder how Windows users deal with
this.

Cheers,
  Nick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]