Problem calling interpreted function from compiled code

Hello,

I have checked the example in demo/makecint/Stub and didn’t get the expected results.
(root 5.26 / Suse Linux 10.3, / gcc 4.2.1)

a) Stub.C and Src.C recompiled with g++, all is OK:
Linux-New:/home/root/cint/demo/makecint/Stub # g++ Src.C Stub.C
Linux-New:/home/root/cint/demo/makecint/Stub # a.out
result=6.28
2 3.14
2 6.28
3 1.2
34
56
-2 2.3
-12
result=6.28
2 3.14
2 6.28
3 1.2
34
56
-2 2.3
-12

b) result of “cint Src.C Stub.C” … produce the same results as above.

c) setup script
After execution of the setup script … the embeded operation of the interpreter produce wrong results:
Linux-New:/home/root/cint/demo/makecint/Stub # setup
##########################################################################

makecint : interpreter-compiler for cint (UNIX version)

Copyright(c) 1995~2007 Masaharu Goto. Mailing list: cint@pcroot.cern.ch

##########################################################################
Run ‘make -f Makefile’ to compile the object
rm -f Stub core G__cpp_Stub.o G__cpp_Stub.cxx G__cpp_Stub.h G__main.o G__setup.o
gcc -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__SIGNEDCHAR -DG__NEWSTDHEADER -DG__CINT_VER6 -DG__NATIVELONGLONG -DG__P2FCAST -DG__STD_EXCEPTION -DG__HAVE_CONFIG -DG__NOMAKEINFO -O2 -DG__CXXLINK_ON -I/home/root/cint/cint/inc -o G__main.o -c /home/root/cint//cint/main//G__main.c
gcc -DG__CXXLINK_ON -I/home/root/cint/cint/inc -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__SIGNEDCHAR -DG__NEWSTDHEADER -DG__CINT_VER6 -DG__NATIVELONGLONG -DG__P2FCAST -DG__STD_EXCEPTION -DG__HAVE_CONFIG -DG__NOMAKEINFO -O2 -o G__setup.o -c /home/root/cint//cint/main//G__setup.c
/home/root/cint/bin/cint -w0 -zStub -nG__cpp_Stub.cxx -D__MAKECINT__ -DG__MAKECINT -c-1 -A -I/home/root/cint/cint/inc -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__SIGNEDCHAR -DG__NEWSTDHEADER -DG__CINT_VER6 -DG__NATIVELONGLONG -DG__P2FCAST -DG__STD_EXCEPTION -DG__HAVE_CONFIG -DG__NOMAKEINFO Src.h +STUB Stub.h -STUB
g++ -I/home/root/cint/cint/inc -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__SIGNEDCHAR -DG__NEWSTDHEADER -DG__CINT_VER6 -DG__NATIVELONGLONG -DG__P2FCAST -DG__STD_EXCEPTION -DG__HAVE_CONFIG -DG__NOMAKEINFO -O2 -DG__GNUREADLINE -c G__cpp_Stub.cxx
g++ -O2 -o Stub G__main.o G__cpp_Stub.o Src.o G__setup.o -L"/home/root/cint/lib" -lCint -lm -ldl /usr/lib/libreadline.a /usr/lib/libncurses.a
result=6.28
2 3.14
2 6.28
3 1.2
34
56
-2 2.3
-12
result=6.28
2 3.14
2 6.28
3 1.2
34
56
-2 2.3
-12

result=6.28
2 3.14
2 6.28
3 1.2
34
56
-2 2.3
-12
result=6.28
2 3.14
2 6.28
0
34
56
0
-12
------------------- diffs between cc.out and cint.out
12c12
< 3 1.2

0
15c15
< -2 2.3


0

What’s the problem ?

–Armin

Hi Armin,

The Stub mechanism no longer properly support the case where the derived class is used via a pointer to the base class in the interpreted code. We do not plan on solving this issue for the time being, hence I updated the demo directory to reflect this change in behavior.

Cheers,
Philippe.

Hello Philipp,

so I have to expect that several demos/examples are a little bit outdated.

However … I’m looking for an example or the possibility to integrate an existing messaging library into CINT ( e.g. zeromq.org). This allows a fast and more or less OS independend communication. What are the right steps with makecint when I have a static or a shared library and its related include files … ?

Thanks

–Armin

[quote=“pcanal”]Hi Armin,

The Stub mechanism no longer properly support the case where the derived class is used via a pointer to the base class in the interpreted code. We do not plan on solving this issue for the time being, hence I updated the demo directory to reflect this change in behavior.

Cheers,
Philippe.[/quote]

Hi,

[quote]This allows a fast and more or less OS independend communication. What are the right steps with makecint when I have a static or a shared library and its related include files … ? [/quote]ROOT itself might actually be a better entry point.

That said :slight_smile:. You will need 2 things, one is to generate dictionaries (see for example demo/makecint/Complex). You might also want to make calls to random interpreted code, this can be done via a call to G__calc, you have example in demo/makecint/p2f and demo/makecint/UserMain (You can get even more control by using G__process_cmd, you can find an example in $ROOTSYS/core/meta/src/TCint.cxx).

Cheers,
Philippe.

Hi Philippe,

thanks a lot. I will follow the coding available in cint/cint/lib … seems to be the easiest way :slight_smile:

Cheers

–Armin

[quote=“pcanal”]Hi,

[quote]This allows a fast and more or less OS independend communication. What are the right steps with makecint when I have a static or a shared library and its related include files … ? [/quote]ROOT itself might actually be a better entry point.

That said :slight_smile:. You will need 2 things, one is to generate dictionaries (see for example demo/makecint/Complex). You might also want to make calls to random interpreted code, this can be done via a call to G__calc, you have example in demo/makecint/p2f and demo/makecint/UserMain (You can get even more control by using G__process_cmd, you can find an example in $ROOTSYS/core/meta/src/TCint.cxx).

Cheers,
Philippe.[/quote]