Hi,
I have an interactive appli in which a user-supplied analysis class is
loaded using the plugin mechanism, i.e. I add dynamically a handler for the class like this:
gROOT->GetPluginManager()->AddHandler("BaseClassName", "UserClassName", "UserClassName", "UserClassName.cpp+", "UserClassName()");
then I check the compilation & (if it works) load it using
TPluginHandler* ph = (TPluginHandler*)gROOT->GetPluginManager()->FindHandler("BaseClassName", "UserClassName");
if( !ph->CheckPlugin() && !ph->LoadPlugin() ) {
BaseClassName* obj = (BaseClassName*)ph->ExecPlugin(0);
}
This basically happens when the user hits the “Process” button in
a GUI, in order to run her analysis.
The problem is that if, after a first successful compilation & load of the user’s code, the user then changes her code & hits “Process” again, the class is not recompiled, and the user unwittingly re-executes exactly the same analysis as before.
How can I make this happen ? I think I have found the way to make it recompile the code every time:
gSystem->Unload("UserClassName_cpp.so");
gROOT->GetPluginManager()->RemoveHandler("BaseClassName", "UserClassName");
TClass::RemoveClass(TClass::GetClass("UserClassName"));
but this is not what I want. How can I get it to recompile the code
only when the code changes ?
Cheers
John