RE: [ROOT] linking and calling comlied code at runtime

From: Philippe Canal (pcanal@popgtw.fnal.gov)
Date: Tue Oct 31 2000 - 21:37:52 MET


Hi Sven,

> (sorry for the lengthy pastes):

Lengthy pastes are sometimes actually better to properly understand the problems.
However you may want to send them directly to rootdev or the person helping you
on the specific problem, rather than sending it to roottalk.

> I'm using root-2.25.03, compiled from source on linux/ppc. I figured
> CompileMacro chokes on the "++", so I removed it and got

You are absolutely right, the ++ are NOT needed in CompileMacro.

> Load Error: Dynamic link library /home/sas/src/ana/macros/AllTasks.so
> can not load
> /usr/lib/crt1.o(.rodata+0x4): undefined reference to `main'
> filelqQLZk.o: In function `operator>>(TBuffer &, AllTasks *&)':

This is due to a current limitation of ACLiC (the utility formerly known
as script compiler).  The script compiled have to be in the current directory :(

So you need to replace:
	  gSystem->CompileMacro( "/home/sas/src/ana/macros/AllTasks.C" );	  

by
       gSystem->cd( "/home/sas/src/ana/macros" );
       gSystem->CompileMacro( "AllTasks.C" );

This limitation will be lifted in a future release of ACLiC.

Also to avoid core dump you should actually use:

       int res = gSystem->CompileMacro( "AllTasks.C" );
       if (res==0) {
		// add some error handling
       }

Philippe.
	 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET