RE: [ROOT] possible root bug involving stl vector?

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Jun 19 2003 - 18:37:05 MEST


Hi Jeremy,

Given your information the most likely cause is that you do not have a
dictionary for vector<float>.

When you run try1.C it works by emulating in the interpreter the vector
class.

When you run try2.C, you are loading a compiled classes which really on the
compiled version of the vector.  The compiled version and the interpreted
version are NOT compatible.  When try2.C gets to: 'std::vector<float>
beta(alpha);' it knows that there is compiled version but can not find how
to use it (missing dictionary).

To solve the problem you can either do:
	gmake cintdlls
in your ROOT distribution.  Or add:
	#pragma link C++ class vector<float>;
to you linkdef file.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Jeremy Gogos
Sent: Thursday, June 19, 2003 9:33 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] possible root bug involving stl vector?


hi. i've been trying to write a simple class to use within root, something
like what's discussed at

http://root.cern.ch/root/roottalk/roottalk99/2746.html

i used rootcint to generate a dictionary for my class (VetoCLS), and my
class and the rootcint-generated dictionary (STLcint) both compile
fine. i can also use gSystem->Load() to load the .so file for these. all
these files (apart from the .so, of course) are included in the attached
tar.gz  file. also included are two root macros, try1.C and try2.C. here's
the contents of try1.C:
{
#include <vector>

std::vector<float> alpha;
std::vector<float> beta(alpha);
}

and try2.C
{
#include <vector>
gSystem->Load("$SRT_PRIVATE_CONTEXT/lib/Linux2.4-GCC/libVetoCLS.so");

std::vector<float> alpha;
std::vector<float> beta(alpha);
}

if i execute try1.C within root, it works fine. if i execute try2.C, i get
the following error:
----------------------------------------------------------------------------
Error: Can't call vector<float,allocator<float>
>::vector<float,allocator<float> >(alpha) in current scope FILE:try2.C
LINE:6
Possible candidates are...
filename       line:size busy function type and name  (in
vector<float,allocator<float> >)
*** Interpreter error recovered ***
----------------------------------------------------------------------------

i'm sure there's probably a problem with the VetoCLS class i wrote, but i
can't see how my class is affecting the way root handles the constructor
for a vector. can anyone see what's wrong?

oh yes, here's my system information. i'm using a redhat 8.0 system with
gcc 3.2 and root v3-05-05 from June 9, 2003.

many thanks for considering my problem.

jeremy


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET