RE: [ROOT] adding a class

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Jul 31 2001 - 17:55:56 MEST


Hi Miro,

> 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.

To have a class in a shared library, be able to be seen by cint, you do
need a dictionary (running rootcint) but you do not need ClassDef and
ClassImp.
Also for simple classes (i.e. class defined in one header, one source file),
you can use ACLiC and just type:
	.L myfile.cxx++
It will take care of the rootcint and compilation step for you.

> root [0] .L pdf.so
>dlopen error: /nevis/nevis11/helbich/xF3/mrst/./pdf.so: undefined symbol:
>DeclFileLine__4MPdf

This is odd .... Pdf::DeclFileLine should declare AND implement by the 
ClassDef macro inside your Pdf class.  One case where I have seen something
like that was when I forgot to implement some of the virtual function of
my class (but usually it complains of a few more missing symbols like __vtbl).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Miroslav Helbich
Sent: Tuesday, July 31, 2001 10:37 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] adding a class



 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



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