[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Different object lists for static and shared libraries
From: |
Ralf Wildenhues |
Subject: |
Re: Different object lists for static and shared libraries |
Date: |
Sun, 28 Jun 2009 09:30:55 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-15) |
Hello Charles,
* Charles Wilson wrote on Sun, Jun 28, 2009 at 12:54:59AM CEST:
> The best I could come up with is this: IN the source code for the object, do
>
> ----- top of file -----
> #if defined(BUILDING_MY_LIBRARY) && defined(DLL_EXPORT)
> stuff
> #endif
> ----- end of file -----
>
> This way, the object is included in both the static and shared
> libraries, but in the former case it doesn't have any contents.
>
> Is there a better way?
Not that I know of. The current code might cause the object list for
the static library to be a larger set than that for the shared library
(because it won't add objects compiled with -static/--tag=disable-shared
to $non_pic_objects), but not vice versa; but my guess is that was only
done to avoid relocation errors.
With a suitably smart linker, your approach shouldn't cause a larger
final shared library product, however.
Cheers,
Ralf