Hi, I'm writing an analysis program that loops over events from trees, performs cuts and fills histograms. Basically it's a decendant of the "Event.h/cxx" framework as provided in the tutorials. In order to vary cuts I would now like to pull the cut logic from my event loop and put in an extra source file. In order to avoid having to recompile/relink for every little change I make I had the idea to dynamically link this file at runtime. While this works w/o problems, I cant't reference any implementations in the extra file, because the linker can't resolve the symbols that are in there. Example: > cat test.C #include <iostream.h> #include <TROOT.h> TROOT root( "test", "Test" ); class MyTask : public TObject { public: Int_t Run(); }; int main( int argc, char **argv ) { gSystem->CompileMacro( "/home/sas/src/ana/macros/test2.C" ); MyTask *task = (MyTask *)root.FindObject( "newtask" ); task->Run(); } ----------------------------------------- > cat test2.C #include <iostream.h> int test2() { cout << "Here's test2!\n"; return( 2 ); }; class MyTask : public TObject { public: Int_t Run(); }; Int_t MyTask::Run() { cout << "Here MyTask!\n"; return( 2 ); }; MyTask newtask; ----------------------------------------- On compiling I get: /home/sas/src/ana/macros/test.C:16: undefined reference to `MyTask::Run(void)' collect2: ld returned 1 exit status which is actually not such a big surprise. But how can I avoid it? Is there a way to tell the linker to ignore unreference symbols? BTW: platform is linux-ppc. I also tried the following approach: Func_t test2 = gSystem->DynFindSymbol( "/home/sas/src/ana/macros/test2.so", "test2" ); But how would I invoke the function? test2() in test.C won't do it and I couldn't find any information on Func_t in the docs. TIA, Sven
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET