Re: dlopen()

ba_f <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
Am 2015-06-25 21:49, schrieb Adam Lackorzynski:
> Hi,
> 
> On Fri Jun 19, 2015 at 16:15:54 +0200, ba_f wrote:
>> is it possible to dlopen() a shared lib?
> 
> Yes.
> 
>> I'd like to execute a program that is started like this:
>> "Example: ./gen_random -d .libs/libsim.so"
>> 
>> I know how to start a program with arguments.
>> But where could i put my shared lib, and which path should i pass to 
>> the
>> executing program?
> 
> All files/modules you put in your modiles.list file entry show up under
> rom/. So it should be: ./gen_random -d rom/libsim.so
> 
> 
> 
> Adam


Ok, thanks Adam.


Yet, i have another (maybe trivial) question.

How do i build a dynamic(!) shared lib for Fiasco, which is loadable 
with dlopen()?


I tried to add the -fPIC flag in the lib Makefile, but it didn't work 
out.


[Makefile]

CPPFLAGS += -fPIC
LOADABLE_MODULE=1

include $(L4DIR)/mk/lib.mk
[/Makefile]


[c]
   dl = dlopen(rom/lib.so, RTLD_NOW);
     if (dl == NULL){
       fprintf(stderr, "dlopen failed: %s\n", dlerror());
[/c]

Output is: dlopen failed: (null)

I can assure that dlopen() finds the lib.so, because dlerror() gives an 
other output when using a different name (e.g. dlopen(rom/crap.so) ).




Greetings,

ba_f
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.