RE: [ROOT] std:vector in commandline

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Nov 18 2004 - 19:15:38 MET


Hi,

These messages usually means that the cintdlls have not been generated.

Cheers,
Philippe 

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]
On Behalf Of Alessandro Thea
Sent: Thursday, November 18, 2004 4:36 AM
To: Root Mailinglist
Subject: [ROOT] std:vector in commandline

Hi all,
I've found a weird behaviour in root command line when I try to use
std::vectors on a Scientific Linux machine.
The problem appears when I create a std::vector<double> after having loaded
a library in which a std::vector<double> is used.
Needless to say, it works perfecly if I load no libraries.

To reproduce this problem I made a script, teststl.C which creates, fills,
and reads a std::vector<double>.
Then I set up class, MyClass which contains just a vector<double>* and I
created the shared library, libtest.so.

This is what I get just running the script:
   *******************************************
   *                                         *
   *        W E L C O M E  to  R O O T       *
   *                                         *
   *   Version   4.00/08      10 July 2004   *
   *                                         *
   *  You are welcome to visit our Web site  *
   *          http://root.cern.ch            *
   *                                         *
   *******************************************

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004 Type ? for help.
Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .x teststl.C
2
a[0]=12
a[1]=1e-05
root [1]

and this is what happens if I load libtest.so, even f i dont' use MyClass at
all:

   *******************************************
   *                                         *
   *        W E L C O M E  to  R O O T       *
   *                                         *
   *   Version   4.00/08      10 July 2004   *
   *                                         *
   *  You are welcome to visit our Web site  *
   *          http://root.cern.ch            *
   *                                         *
   *******************************************

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004 Type ? for help.
Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L libtest.so
root [1] .x teststl.C
Error: Can't call vector<double,allocator<double> >::push_back(12.) in
current scope FILE:teststl.C LINE:5 Possible candidates are...
filename       line:size busy function type and name  (in
vector<double,allocator<double> >)
Error: Symbol a is not defined in current scope  FILE:teststl.C LINE:5
Error: Failed to evaluate a.push_back(12.)Possible candidates are...
filename       line:size busy function type and name
*** Interpreter error recovered ***
root [2]

I found that this error appears just on Scientific Linux v3, with gcc
version 3.2.3 20030502 (Red Hat Linux 3.2.3-39). I've tried with both root
4.00.06 and root 4.00.08.

On the contrary, it works perfectly on RedHat 9, gcc 3.2.2 and RedHat
7.3 gcc 2.96.
Do you have any idea?

I have attached the code that reproduces the problem.
Thanks and Regards,
Alessandro



--
__________________________________________________________________________

   Alessandro Thea
   Ph.D. Student
   Dipartimento di Fisica dell'Universita' di Genova and
   Istituto Nazionale di Fisica Nucleare, Sezione di Genova,
   Via Dodecaneso 33, I-16146, Genova, Italia.

   Tel : +39 010 3536468               E-Mail: Alessandro.Thea@ge.infn.it
   Cell: +39 349 2724919
__________________________________________________________________________



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET