RE:[ROOT] Shared library loading under linu

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Mar 28 2000 - 14:00:39 MEST


Hello Matevz,

If you want to get a handle to procedure, you can simply use G__findsym() API.
This hasn't been documented, so very few people knew it.

 void* G__findsym(const char* symname);

This API searchs all loaded shared libraries. The operation is almost 
platform independent, except for following matters.

 1) Win32 and AIX 
    You need to explicitly export the symbols if you want to get handle by
    G__findsym.
 2) Some platform adds '_' in front of the function name
 3) If you want a C++ symbol name you need to know name mangling rule of the
    C++ compiler you use. If you don't like to do so, you need to declare the
    function 'extern "C"'.

Thank you
Masaharu Goto


>Hi!
>
>Would like to get address of a symbol from a shared library when i load it
>with gSystem->Load(<soname>). I know this gets very OS specific ... but is
>it possible to retrieve lib handle as returned by
>void *dlopen (const char *filename, int flag);
>
>Tried to trace it down the CINT ... got a little cloodgy feeling ...
>
>Is it enough to access
>G__sl_handle[G__allsl - 1] and then call G__shl_findsym(...)
>or will i be missing sth?
>
>Btw ... why is this not implemented (is implemented only for HPUX) in
>Func_t TSystem::DynFindSymbol(const char* module, const char* entry)?
>
>
>Cheers,
>matevz



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET