Re: dlopen()

Adam Lackorzynski <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
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                 [email protected]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/
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.