Re: [ROOT] adding a class

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Jul 31 2001 - 18:05:22 MEST


Hi Miroslav,

  to make your classes known to CINT you don't have to add ClassDef/ClassImp.
Just add them to the list of pragma's in a LinkDef.h file, run rootcint to
make a dictionary and compile and link the dictionary with the classes.
After loading the shared lib you can access these classes from the interpreter.

The error in 2) might be due to not having all methods implemented. Did you
forget to implement some virtual Pdf method?

Cheers, Fons.



Miroslav Helbich wrote:
> 
>  Hi all,
> 
>   I failed badly in adding a new class to root. Well, it worked well with
> the very simple examples, but this doesn't.
> 
> I got a junk of code including classes which was not intended to be used
> by root. Therefore a person didn't care about adding all the ClassDef and
> ClassImp macros, having default constructors or putting just one class per
> file. I don't want to touch debuged code, but I want to use it.
> 
> Questions are:
> 
>  1;  Well .L myfile.cxx works, but .. Is there a way to add it as a shared
> library without adding all ClassDef etc. macros? Adding them makes my
> code not to compile in different application. I don't want
> any I/O. If I make a shared library without all that it compiles fine,
> but Cint doesn't recognize my classes.
> 
>  2; I wrote a small class which uses the mentioned classes. If I add the
> ClassDef and ClassImp macros to my new class, generate dictionary etc.,
> but I left other classes untouched. I don't intend to call them directly
> from root. It complains when loading shared library into root.
> 
>  root [0] .L pdf.so
> dlopen error: /nevis/nevis11/helbich/xF3/mrst/./pdf.so: undefined symbol:
> DeclFileLine__4MPdf
> Load Error: Failed to load Dynamic link library
> /nevis/nevis11/helbich/xF3/mrst/./pdf.so
> *** Interpreter error recovered ***
> 
>  At the end I want to use libraries, since I want to integrate some
> fortran functions into my system and that obviously cannot be done by root
> interactive compiler.
> 
>  Can anyone give me a clue on how to deal with it?
> 
>                                 Regards
> 
>                                         Miro

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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