[ROOT] SOLVED! Re: passing classes to functions

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Fri Sep 07 2001 - 16:10:47 MEST


Hi all,
I fix my problem!
When I pass a class to a function, as I
load the class via gSystem->Load("libMyClass.so");, I need to do a forward
declaration of MyClass just before the function description, since it
stays normally before the body of the main macro.
Sorry. Mine  was a deleted alarm!

Cheers, Tommaso

On Fri, 7 Sep 2001, Tommaso Chiarusi wrote:

> Dear Rooters,
> 
> I build such an organized  root macro Pippo.C:
> (I give a simplified sketch only!)
> ____________________________________
> #includefiles
> 
> void Func(MyClass* aa){
> .....
> }
> 
> void Pippo(){
> MyClass* a = new MyClass(...);
> ...
> function(a);
> ...
> }
> _____________________
> 
> Note that:
> -Isnide the body of macro Pippo I call the function func
> -a is a pointer to class MyClass object
> 
> My problem is:
> IF I use the class MyClass including it directly by the INCLUDEFILES at
> the beginning of the script (i.e. #include "MyClass.h") it works,
> 
> If I include MyClass via libMyClass.so
> (i.e.   I put at the beginning of the Pippo macro the command  
> 	gSystem->Load("libMyClass.so");
>  )
> it DOESN'T work!
> 
> Why this different behaviour? 
> 
> Which are the advantages in using a compiled library (with a Root
> Dictionary) with respect of using a normal include file.h?
> 
> Thank you, Tommaso
> 
> 
> P.S. 
> I know that may be using functions would sound like "a la
> fortran77"... better is implementing a Class, isn't it?
>  
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:59 MET