Re: dlopen searching application?
From: bd (bdonlan_at_bd-home-comp.no-ip.org)
Date: 04/29/03
- Next message: scriptOmatic: "Re: Anybody ever used longjmp or siglongjmp correctly in a signal handler?"
- Previous message: rg: "Re: Library or Source Code for Eigenvalue of Float matrix"
- In reply to: Fletcher Glenn: "Re: dlopen searching application?"
- Next in thread: Martien Verbruggen: "Re: dlopen searching application?"
- Reply: Martien Verbruggen: "Re: dlopen searching application?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 28 Apr 2003 19:52:19 -0400
On Mon, 28 Apr 2003 23:29:50 +0000, Fletcher Glenn wrote:
> bd wrote:
>>
>> How can I get dlopen to link functions in the program calling it? E.g, I
>> have a function foo() in the program itself, and at some point the program
>> loads library bar, which needs to call foo(). How can I get dlopen to do
>> this?
>
> Isn't that what dlsym is supposed to do?
You misunderstand - foo() is in the programming calling dlsym(). It's like
this:
--- app.c ---
void foo(){
/* ... */
}
void bar(){
void *lib;
void (*quux)();
lib = dlopen("somelib.so", RTLD_NOW | RTLD_GLOBAL);
quux = dlsym(lib, "quux");
quux();
dlclose(lib);
}
--- end app.c ---
--- somelib.c ---
extern void foo();
void quux(){
/* ... */
foo();
/* ... */
}
- Next message: scriptOmatic: "Re: Anybody ever used longjmp or siglongjmp correctly in a signal handler?"
- Previous message: rg: "Re: Library or Source Code for Eigenvalue of Float matrix"
- In reply to: Fletcher Glenn: "Re: dlopen searching application?"
- Next in thread: Martien Verbruggen: "Re: dlopen searching application?"
- Reply: Martien Verbruggen: "Re: dlopen searching application?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|