[dmd-internals] Making druntime a shared library on linux
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Mar 25 17:21:37 PDT 2013
On Mon, Mar 25, 2013 at 04:49:00PM -0700, H. S. Teoh wrote:
> On Mon, Mar 25, 2013 at 04:46:12PM -0700, Walter Bright wrote:
> >
> > On 3/25/2013 3:19 PM, Jonathan M Davis wrote:
> > >On Monday, March 25, 2013 12:46:46 Walter Bright wrote:
> > >>I couldn't find a linker flag to prefer libdruntime.so over libdruntime.a,
> > >>or vice versa, so I named the shared library libdruntimeso.so. Ugh. If
> > >>there's a better way, please let me know.
> > >I believe that the .so is preferred over the .a so that you normally give the
> > >.a version explicitly if you want to link against it,
> >
> > Tried that (giving a .so or .a explicit extension). Doesn't work, it
> > just gives an error.
> [...]
>
> AFAIK, if you're giving an explicit extension, you have to specify the
> filename instead of -l<name>, something like:
>
> ld -oexecutable program.o libabc.so
>
> Assuming you have library paths setup correctly (or have requisite -L
> flags), using -l should prefer .so over .a:
>
> ld -oexecutable program.o -labc
> (should link in libabc.so, assuming both libabc.so and libabc.a
> are found in the library paths)
[...]
Actually, scratch that. According to ld's manpage, using -l *always*
links with the .a. My bad.
T
--
Talk is cheap. Whining is actually free. -- Lars Wirzenius
More information about the dmd-internals
mailing list