Get address of namespace function from TMethod

I have a namespace with functions:

namespace KVTGIDFunctions {
Double_t tassangot_Z(Double_t * x, Double_t * par);

which is included in the dictionary using

#pragma link C++ namespace KVTGIDFunctions;

How can I get the addresses of these functions using TClass/TMethod etc. ?

On the Cint command line I get:

root [22] KVTGIDFunctions::tassangot_Z
(const void*)0x32873c8

so I assume it must be possible, but all I have managed so far is:

root [18] meth->InterfaceMethod()
(const void*)0x33264ae

InterfaceMethod is the only method I found returning a ‘void*’, but the
address is not the right one, so I guess it’s wrong.

Thanks for your help

PS. the point of all this is to reinitialise the ‘lost’ function pointers of TF1 objects read from a file using the name of the appropriate function to search for the pointer (there are more than one functions in the namespace).

Hi John,

try void* func = (void*)gROOT->ProcessLine("KVTGIDFunctions::tassangot_Z");
Cheers, Axel.

Hi Axel

Very cunning reply!!! :laughing:

Unfortunately, this does not compile, as return type of TROOT::ProcessLine is ‘void’; however, with a slight modification:

That works!
Thanks a lot

Why can you not just take the address of the routine?

Double_t (func)(Double_t, Double_t*) = & KVTGIDFunctions::tassangot_Z;

Do you have dynamically changing routines?

Hi John,

[quote=“j.d.frankland”]Unfortunately, this does not compile, as return type of TROOT::ProcessLine is ‘void’[/quote]Sorry, I meant TROOT::ProcessLineFast(), which returns the proper value.