[ROOT] RE:Odd dictionary code -- tempobject

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Oct 02 2001 - 23:17:08 MEST


Hello Philippe,

Thank you for pointing this out. I'll add type information
in the G__CallFunc::Exec function in next release.

Thank you
Masaharu Goto


>Date: Mon, 01 Oct 2001 15:32:54 -0500
>From: Philippe Canal <pcanal@fnal.gov>
>To: Masaharu Goto <MXJ02154@nifty.ne.jp>
>Cc: pcanal@fnal.gov
>Subject: Odd dictionary code -- tempobject
>
>Hi Masa,
>
>With the file pb01.C and pb01Linkdef.h below, I run:
>
>  rootcint -f pb01dict.cxx -c pb01.C pb01linkdef.h
>  g++ -I$ROOTSYS/include pb01dict.cxx pb01.C -shared -o pb01.so
>
>Then I look at the code of the wrappers generated for pb01::get1 :
>
>
>  static int G__pb01_get1_0_0(G__value *result7,G__CONST char *funcname,
>       struct  G__param *libp,int hash) {
>    {
>      Obj *pobj,xobj=((pb01*)(G__getstructoffset()))->get1();
>      pobj=new Obj(xobj);
>      result7->obj.i=(long)((void*)pobj); result7->ref=result7->obj.i;
>       G__store_tempobject(*result7);
>    }
>    return(1 || funcname || hash || result7 || libp) ;
>  }
>
>I noted that only result7->obj.i and result7->ref are being set.
>I also note that G__free_tempobject is using code like (parse.c 1910
>and below):
>
>    G__tagnum = G__p_tempbuf->obj.tagnum;
>    .....    
>    sprintf(statement,"~%s()",G__struct.name[G__tagnum]);
>
>which assume that result7->obj.tagnum has been set properly (which
>does not seem to be the case!).
>
>This lead to a problem in a case where the method is being called by
>G__CallFunc::Exec.  The symptom is that in this case the G__p_tempbuf
>is not emptied after the execution of the function (which is, I think,
>the correct behavior).  However, cint tries to empty it the next time
>a command line is being parsed/executed and then provokes messages like:
>
>   Error: Symbol null is not defined in current scope  FILE:bug.C LINE:8
>
>[For my own sake I will also need to have an API to empty this list of
>temporary object when I know I do not need them anymore]
>
>Do you known how to fix this problem?
>
>Thanks,
>
>Philippe.
>
>//===========================
>// pb01.C 
>class Obj {
>public:
>  int a;
>  Obj(int arg1) { a = arg1; };
>};
>
>typedef Obj Alternate;
>
>class pb01 {
>public:
>
>  // return an object directly
>  Obj get1() { return Obj(1); };
>  Alternate get2() { return Obj(2); };
>  
>};
>
>//=============================
>//pb01Linkdef.h
>#ifdef __CINT__
>
>#pragma link off all globals;
>#pragma link off all classes;
>#pragma link off all functions;
>
>#pragma link C++ class Obj;
>#pragma link C++ class pb01;
>
>
>#endif
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:02 MET