Re: [ROOT] pointer to function

From: Colin Bernet (bernet@hep.saclay.cea.fr)
Date: Fri Dec 13 2002 - 11:52:38 MET


Hi Jacek, 

Thank you for your answer. I read that already, and I thought I was not 
concerned :

G__isinterpretedp2f()

int G__isinterpretedp2f(void *p2f)

(...)

"It is unneccessary to use G__isinterpretedp2f() API in interpreter
environment because cint will automatically distinguish between the
pointer and handle it properly"


Anyway I tried to use this function :

root [2] G__isinterpretedp2f(&pass)
(const int)2

so my pointer is a "Pointer to an interface method of user embedded
precompiled global function". 

in the code on the same page, I saw what I have to do in this case (btw
cint knows it is a pointer of type 2, and can do that
automatically, as said in the precited sentence)

case G__COMPILEDINTERFACEMETHOD: // using interface method
     G__CallFunc func;
     func.SetFunc((G__InterfaceMethod)p2f);
     func.SetArg((long)a);
     func.SetArg((double)b);
     result=func.ExecInt((void*)NULL);
     break;

so : 

root [3] G__CallFunc func
Error: Symbol G__CallFuncfunc is not defined in current scope
FILE:/tmp/fileUIIYRg_cint LINE:1
*** Interpreter error recovered ***


I tried to include Api.h, but :

root [5] #include "Api.h"  
Note: posix.dll is not found. Do 'sh setup' in $CINTSYSDIR/lib/posix
directory if you use UNIX.

so I did that :

[bernet@daplxa127 posix]$ cd $ROOTSYS/cint/lib/posix/
[bernet@daplxa127 posix]$ sh setup
################################################################
# makecint : interpreter-compiler for cint (UNIX version)
#
# Copyright(c) 1995~2002 Masaharu Goto (MXJ02154@niftyserve.or.jp)
#                        (cint mailing list 'cint@root.cern.ch')
################################################################
Makefile is created. Makecint success.
Do 'make -f Makefile' to compile the object
gcc       -o exten.o -c exten.c
make: *** No rule to make target
`/home/manip/mnt/compass/root_3.03.09/cint/cint', needed by
`G__c_posix.c'.  Stop.
rm: cannot remove `G__*': No such file or directory

then no makefile created...


there are still a lot of traps, and I couldn't manage to pass this pointer
to compiled function to a compiled function in interpreted mode...

thank you for any help,
Colin




On Thu, 12 Dec 2002, Jacek M. Holeczek wrote:

> Hi,
> I'm affraid you will need to become familiar with :
> 	int G__isinterpretedp2f(void *p2f)
> For details see :
> 	http://root.cern.ch/root/Cint.phtml?ref
> Some "real life" examples you can also find in :
> 	ftp://root.cern.ch/root/TF77.tar.gz
> Best regards,
> Jacek.
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:23 MET