root [0] .rawInput
Using raw input
root [1] void It_s_a_Lulu();
root [2] .rawInput
Not using raw input
root [3] auto ci = gInterpreter->ClassInfo_Factory();
root [4] gInterpreter->ClassInfo_HasMethod(ci, "It_s_a_Lulu")
(bool) true
root [5] gInterpreter->ClassInfo_Delete(ci);
Oh you don’t want to know whether it’s declared - you want to know whether it is implemented or an unresolved symbol! Yes, that’s through mangling. Are you in a position to name the function yourself? If so, mark it as extern "C" (so it doesn’t get mangled) and use just dlsym(RTLD_DEFAULT, "It_s_a_Lulu"). That’s for shared libraries; if you also want to query the interpreter then tell me because dlsym won’t know.
root [0] .rawInput
Using raw input
root [1] int SomeFunction() { return 42; }
root [2] .rawInput
Not using raw input
root [3] gInterpreter->GetMangledNameWithPrototype(nullptr, "SomeFunction", "")
(TString) "_Z12SomeFunctionv"[17]
Thanks. I think I finally start to understand how it works (in my earlier trials, I missed the requirement that “.rawInput” must be used, otherwise these “GetMangledName*” functions return empty strings):
In one of your previous posts, you say that one could also use enable_if and constexpr. Could you give some examples (I guess this may be interesting for many people).
I was missing the point that you wanted to check for available definitions. SFINAE cannot (intentionally) check for that, it can only check whether there’s a declaration or not. And the link I gave for SFINAE is basically as good as it gets