Address of a symbol in a shared library

From my macro I create a file, write definition of a function into it and compile with gSystem->CompileMacro(filename);
How do I get an address of the function from the just-loaded shared library? gInterpreter->FindSym(function_name) returns NULL.

Maybe @Axel has an idea… :wink:

Mark that function extern "C" so it doesn’t get mangled.

Or forward declare the function and call it; cling will find the symbol just fine.

Axel.

extern "C" doesn’t help.

I can’t forward declare, because I generate functions with random names. Also, no cling — CINT :cry:

BTW, I can’t find the function name in the nm output for the .so. This might be the problem.

Indeed. Can you post an example of the macros you generate?

Forgot to fflush the FILE before calling CompileMacro, LOL.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.