[fpc-other] How to set library search path ?
Fred van Stappen
fiens at hotmail.com
Mon Mar 13 18:16:24 CET 2017
Wow, many thanks Silvio.
OK, your demo works.
But what about if liba has dependencies with no path defined:
---> handle = dlopen("../libb/libb.so", RTLD_LAZY); ---> ok it works but the path was defined.
But if no path was defined, IMO it will work only if libb.so is in /usr/lib/ or usr/local/lib.
And that is the case of many libraries. There is no path defined for the dependencies.
And it is the challenge, how to define a different path than /usr/lib/ or usr/local/lib.
Many thanks.
Fre;D
________________________________
De : fpc-other <fpc-other-bounces at lists.freepascal.org> de la part de silvioprog <silvioprog at gmail.com>
Envoyé : lundi 13 mars 2017 17:10
À : Other FPC related discussions
Objet : Re: [fpc-other] How to set library search path ?
On Mon, Mar 13, 2017 at 12:19 PM, silvioprog <silvioprog at gmail.com<mailto:silvioprog at gmail.com>> wrote:
On Mon, Mar 13, 2017 at 8:04 AM, Fred van Stappen <fiens at hotmail.com<mailto:fiens at hotmail.com>> wrote:
Hello and thanks to Silvio, z505, Giuliano.
[...]
And this is the challenge, how to load that dependeny if they are not in the lib-system directory.
Strange. I'm using loadlibrary/dlsym and both works properly here. o.O Could you test the attached example? See its result on my Linux:
$ make
Free Pascal Compiler version 3.1.1 [2017/03/12] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test/test.pp
Linking test/test
38 lines compiled, 0.1 sec
$ make test
I'm lib A
I'm lib B
Example II (using both loadlibrary and dlsym):
- fpc loads liba/liba and calls their funcs;
- liba loads dep libb and calls its func;
- libb loads dep liba and calls its func.
Result:
$ make test
I'm lib A
a.dep: I'm lib B
I'm lib B
b.dep: I'm lib A
I think this test above simulates a plugin/module dependence environment. :-)
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-other/attachments/20170313/5124e083/attachment.html>
More information about the fpc-other
mailing list