Re: streams with CInt

Rene Brun (Rene.Brun@cern.ch)
Mon, 06 Oct 1997 08:59:22 +0200


William J. Deninger wrote:
>
> Valery,
>
> I don't understand exactly what rootcint is asking me to do concerning
> "manual intervention". Is there a rootcint manual availiable somewhere
> online?
>
> E:\ROOT-T~1>rootcint mydict.cpp -c CUNIDAQ.H CINFO.H FPOINT.H READFILE.H
> STATION.H WIREINFO.H
> Note: operator new() masked c
> Note: operator delete() masked c
> *** Datamember STATION::base: pointer to fundamental type (need manual
> intervention)
> *** Datamember READFILE::buffer: pointer to fundamental type (need
> manual intervention)
> *** Datamember CUNIDAQ::hfile: pointer to fundamental type (need manual
> intervention)
> *** Datamember CUNIDAQ::recorddata: pointer to fundamental type (need
> manual intervention)
>
> Also, I'm still having troubles with file streams crashing root. See
> http://root.cern.ch/root/roottalk/0890.html.
> Compiling the classes using MSVC seems to get things to run, but only up
> to the point of the stream destructor call. Linking warnings suggested
> this would happen. Any ideas?
>
> --------------------Configuration: CInfo - Win32
> Debug--------------------
> Compiling...
> mydict.cpp
> Linking...
> LINK : warning LNK4075: ignoring /INCREMENTAL due to /MAP specification
> LINK : warning LNK4103: import of deleting destructor "public: virtual
> void * __thiscall ifstream::`vector deleting destructor'(unsigned int)";
> image may not run correctly
> LINK : warning LNK4103: import of deleting destructor "public: virtual
> void * __thiscall filebuf::`vector deleting destructor'(unsigned int)";
> image may not run correctly
>
> CInfo.exe - 0 error(s), 3 warning(s)
>
> William Deninger
> deninger@uiuc.edu

If your class has a data member which is a pointer to a basic data type,
eg:
float *farray;
rootcint has a problem to automatically generate the code for the
function Streamer (Input/Output). How to know the length of the array?
You have the choice in modifying either your class definition
to use one of the Root array classes instead of your own array
or write yourself the Streamer function for your class.
If you choose to use your own array, proceed as follows:
- Make a first pass with rootcint to generate the Streamer function.
In the code generated, rootcint has flagged the statement you should
modify. For example, if you have the length of your array as a data
member
of the class (say length), you must replace/insert the statement
ReadFastArray(farray, length);
in the part of Streamer Reading an object and
WritefastArray(farray,length);
in the part of the code Writing an object.
- Make a second pass to generate the dictionary for your class without
generating the code for Streamer. You instruct rootcint to do so
by adding a - sign to the name of your class. Example, if your
class name is MyClass, then :
#pragma link C++ class MyClass-

Regarding your second problem, I would need your header file to
give a precise answer. For classes derived from TObject, you MUST
have a destructor declared virtual.

Rene Brun