Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Nov 2019 00:22:58 -0800
From:      Doug Hardie <bc979@lafn.org>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Linking to a static library and replacing modules
Message-ID:  <B85EC6BE-CDB9-4776-AEF1-E000B6498F1A@mail.sermon-archive.info>

next in thread | raw e-mail | index | archive | help
I have a collections of modules linked into a static library.  These are =
called from other modules compiled separately from the library.  There =
are 3 stub modules in the library.  The point was that they are called =
by other modules in the library.  Often an application need to replace =
one or more of the stubs with a module that does some real work.  In the =
past the loader just linked the new modules in place of the old one.  =
However, now it seems to be a bit more random.  I have one program where =
it links the way I want.  Others the loader returns a duplicate symbol =
error and dies.  I can't find any differences between those two =
situations.  For the time being, I removed the 3 stubs from the library =
and force the users to include them. It works, but it is not elegant. =20=


How do you build a library such that lld will replace modules in the =
library if there is a replacement in the user's code?  I found a few =
things that appear to be more Linux based and tried them.  None of them =
worked.  I am using FreeBSD 12.1.

-- Doug




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B85EC6BE-CDB9-4776-AEF1-E000B6498F1A>