RE: [ROOT] Libraries with Namespaces

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Apr 14 2003 - 23:31:23 MEST


Hi Ray,

In both case you should replace:
    UAL::Probe h()
by
    UAL::Probe h;

In the make case, you need to add
    #pragma link C++ nestedclasses;
in you linkdef file.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ray Fliller III
Sent: Monday, April 14, 2003 3:46 PM
To: ROOT mailing list
Subject: [ROOT] Libraries with Namespaces




  Hello ROOTers,

   I am using ROOT CVS as of Monday morning.  I am trying to make a
libraray with a class inside of a namespace.  I am able to compile using
ACLIC and make, but I get a different behaviour in each case.

  If I compile with ACLIC:

root [0] .L Probe.cc++
Info in <TUnixSystem::ACLiC>: creating shared library
/home/rainman/rfliller/ual1/examples/CINT/./Probe_cc.so
root [1] g=new UAL::Probe()
This is the constructor
(class UAL::Probe*)0x8b57700
root [2] UAL::Probe h()    Limitation: Function can not be defined in a
command line or a tempfile
You need to write it in a source file FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***
root [3]

and for the case that I use make:

root [0] gSystem->Load("Probe.so")
(int)0
root [1] g=new UAL::Probe()
Error: Can't call Probe::Probe() in current scope FILE:(tmpfile) LINE:1
Possible candidates are...
Error: class,struct,union or type Probe not defined  FILE:(tmpfile) LINE:1
filename       line:size busy function type and name
Warning: Automatic variable g is allocated FILE:(tmpfile) LINE:1
Error: Undeclared variable g FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***
root [2] UAL::Probe h()
Limitation: Function can not be defined in a command line or a tempfile
You need to write it in a source file FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***
root [3]

I am puzzled by this.  Of course the easy answer is not to use a
namespace.  But for this application, I would like to keep the namespace.

I have attached the class definition files, the LinkDef file and the make
file.

Thank you.


--

 RAINMAN
      "How much does a piece of gum cost Ray?"
      "About $100."
      "How much does a new car cost Ray?"
      "`Bout $100."
      "There goes working for NASA!"

==================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
C-A Accelerator Physics            Dept. Fax: (631)-344-5954
Building 911B
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211

http://www.agsrhichome.bnl.gov/People/rfliller/
==================================================================


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



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