dlopen()

Adam Lackorzynski adam at os.inf.tu-dresden.de
Tue Jul 7 00:19:24 CEST 2015


On Mon Jul 06, 2015 at 10:46:21 +0200, ba_f wrote:
> 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()?

In the Makefile you have the TARGET end with .so, for example:
TARGET = libfoo.a libfoo.so
will build both the static and shared lib.

> [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) ).

Works now?



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list