Making a shared library

Hello,

I am running root 4.00/08

  1. I am trying to make a shared library by typing in root seccion
    .L TSU2Matrix.cxx+
    than nothing happens untill you press Cntrl^C than compilation finishes and library is ready. Why do I need to press Cntrl^C?

  2. If I try to use std::complex except TComplex in my class TSU2Complex I am not able to assign new values
    std::complex a=std::complex(1,1).
    If I use
    typedef std::complex std_complex
    and
    add a line to TSU2ComplexLinkDef.h
    #pragma link C++ typedef std_complex;
    it still doesn’t work

    root [0] #include
    root [1] .L libTSU2Matrix.so
    root [2] TSU2Matrix M;
    root [3] M.Print();
    (0,0) (0,0)
    (0,0) (0,0)
    root [4] M(0,0)=std_complex(0.0,1.0);
    Error: operator<< not defined for basic_ostream<char,char_traits >
    FILE:_complex LINE:17
    *** Interpreter error recovered ***

With respect,
Anton
P.S. I included TSU2Matrix.h TSU2Matrix.cxx TSU2MatrixLinkDef.h
TSU2MatrixLinkDef.h (97 Bytes)
TSU2Matrix.cxx (2.09 KB)
TSU2Matrix.h (1.18 KB)

[quote]than nothing happens untill you press Cntrl^C than compilation finishes and library is ready. Why do I need to press Cntrl^C?
[/quote]
I can not reproduce this problem!

[quote]add a line to TSU2ComplexLinkDef.h
#pragma link C++ typedef std_complex;
it still doesn’t work
[/quote]
The dictionary for std::complex is not provided in the ROOT build. So you need to explicitly generate it by simply adding the following line to your linkdef file:

Cheers,
Philippe.

Hi,

  1. here is my linkdef file

#ifdef __CINT__ #pragma link C++ typedef std_complex; #pragma link C++ class std::complex<long double>; #pragma link C++ class TSU2Matrix+; #endif

trying to compile gives a following error however compilation finishes

[code]>make libTSU2Matrix.so
g++ -O -Wall -fPIC -pthread -I/usr/local/root/include -c TSU2Matrix.cxx
Generating dictionary TSU2MatrixDict.cxx…
rootcint -f TSU2MatrixDict.cxx -c TSU2Matrix.h TSU2MatrixLinkDef.h
Syntax error FILE:_complex.h LINE:16
Error: Symbol longdoublere,im is not defined in current scope FILE:_complex.h LINE:26
g++ -O -Wall -fPIC -pthread -I/usr/local/root/include -c TSU2MatrixDict.cxx
g++ -shared -O TSU2Matrix.o TSU2MatrixDict.o -o libTSU2Matrix.so
libTSU2Matrix.so done

[/code]
What does it mean?

  1. When I add to linkdef file in order to make the operator to work
#pragma link C++ function operator<<(std::ostream&, const std::complex<long double>&);

I get

[code]>make libTSU2Matrix.so
Generating dictionary TSU2MatrixDict.cxx…
rootcint -f TSU2MatrixDict.cxx -c TSU2Matrix.h TSU2MatrixLinkDef.h
Warning: #pragma link, function operator<<(std::ostream&,const std::complex&) not found FILE:TSU2MatrixLinkDef.h LINE:4
Syntax error FILE:_complex.h LINE:16
Error: Symbol longdoublere,im is not defined in current scope FILE:_complex.h LINE:26
g++ -O -Wall -fPIC -pthread -I/usr/local/root/include -c TSU2MatrixDict.cxx
g++ -shared -O TSU2Matrix.o TSU2MatrixDict.o -o libTSU2Matrix.so
libTSU2Matrix.so done

[/code]
and operator << still doesn’t work.

  1. About Cntrl^c problem I can only add that I am using root 4.00/08 compiled with gcc3.2.1 under alt-linux 2.4.20-alt16-up i686

Anton