On another thread we discussed how to load a custom library when executing a script. A solution was proposed that worked for the first execution of the script, but upon a repeated execution the script failed:
I was asked to open a new thread to discuss the issue, so here it is.
Is there a way to somehow just avoid reloading the library and simply using what was previously loaded? Some sort of if statement wrapped around like the following nonworking example:
Because reloading of that script fails. It works for some, fails for some, and we’re going to make lots of progress on it this year (we have a couple of crucial pull requests pending on that already).
Alright, Thanks for the info. I’ll hold my breath and see whats coming.
For now I’ve stepped around the problem by having two macros. The first loads the library and the second does the work. I can reload the second ad nauseum without any issues.
/// Loading script, load this only once.
{
gSystem->Load("libFoo.dylib");
gSystem->ProcessLine(".L workMacro.C");
}
// Work macro, can be reloaded with `.L workMacro.c`
void workMacro() {
//Do some work
}