[JDEV] Scripting/Modules/Rant

arh14 at cornell.edu arh14 at cornell.edu
Thu Aug 12 10:34:51 CDT 1999


On Wed, 11 Aug 1999, Aaron Brady (insomnike) wrote:

> And example of how procedures are run from a .so file:
> 
> void main(void) {
>  void *phoe = dlopen ("mod_filetrans.so", RTLD_LAZY);
>  int (*funk)(int) = dlsym(phoe, "handle_prefs");
>  printf ("[%d]\n", (*funk)(1));
>  dlclose(phoe);
> }

Somewhat like the Win32 Way.  The same general thing happens: you load 
the DLL (~dlopen), you find a pointer to the function you want (~dlsym), 
then you use the pointer as a function pointer and call it (~*funk).

Same thing.

Aaron




More information about the JDev mailing list