Hi Sebastien,
thanks for your report + diagnosis. That's now fixed in the trunk.
Cheers, Axel.
Sebastien Binet wrote on 05/17/2011 01:33 PM:
> On Tue, 17 May 2011 12:22:16 +0200, Sebastien Binet <binet_at_cern.ch> wrote:
>> On Tue, 17 May 2011 11:04:10 +0200, Axel Naumann <Axel.Naumann_at_cern.ch> wrote: >>> Hi Sebastien, >>> >>> I don't know how you bind it to Go. How does the constructor get >>> invoked? >> that's probably done by TTree/TBranch... I am not calling it directly. >> >>> I.e. is Reflex::FunctionMember::Invoke() really called? Can you >>> send the backtrace? >> ah! got it. >> it is probably b/c of: >> http://root.cern.ch/lxr/source/cint/reflex/src/Object.cxx#89 >> 80 //------------------------------------------------------------------------------- >> 81 // Invoke a data member of this object. Sign can be used for finding overloaded funs. >> 82 // Put return value(if not void) into ret. >> 83 Member m = TypeOf().FunctionMemberByName(fm, sign); >> 84 >> 85 if (!m) { >> 86 throw RuntimeError("No such MemberAt " + fm); >> 87 } >> 88 >> 89 m.Invoke(*this, ret, args); >> 90 }
>> >> Object::Invoke not passing m.Stubcontext() to m.Invoke... >> >> -s >> >> >>> >>> Cheers, Axel. >>> >>> >>> Sebastien Binet wrote on 05/17/2011 10:46 AM: >>>> >>>> hi there, >>>> >>>> (still playing with Go) >>>> I am seeing something rather strange: >>>> >>>> say I have these structs: >>>> >>>> /** edm **/ >>>> typedef struct { >>>> double E; >>>> double T; >>>> } Det; >>>> >>>> typedef struct { >>>> Det A; >>>> Det B; >>>> } Event; >>>> >>>> size_t g_sz_det = sizeof(Det); >>>> size_t g_sz_evt = sizeof(Event); >>>> >>>> >>>> and the corresponding c-tor stub functions: >>>> /* stub functions for Event */ >>>> void ctor_Event(void *retaddr, void *mem, void* args, void* ctx) >>>> { >>>> fprintf(stderr, "::ctor-fct[Event] [%p] [%p] [%p] [%p]\n", retaddr, mem, args, ctx); >>>> void* dummy = 0; >>>> if (retaddr) *(void**)retaddr = (Event*)realloc(mem, sizeof(Event)); >>>> else dummy = (Event*)realloc(mem, sizeof(Event)); >>>> if (dummy) {} >>>> } >>>> >>>> /* etc... */ >>>> >>>> the ctor_Event stub function is attached to the Event Reflex::Type like >>>> so: >>>> Reflex::ClassBuilder cb = ...; >>>> Reflex::Type ty_ctor = Reflex::FunctionTypeBuilder(ty_void); >>>> void *ctx = &g_sz_evt; >>>> cb.AddFunctionMember(ty_ctor, "Event", &ctor_Event, ctx, NULL, >>>> Reflex::PUBLIC|Reflex::CONSTRUCTOR); >>>> >>>> >>>> so far so good, and when iterating over the function members of the >>>> "Event" type I do see: >>>> :: Evt-size: 32 32 >>>> :: Evt-mbrs: 2 >>>> :: Evt-type: 117 >>>> :: Evt-name: Event >>>> :: Evt-id: 0x11c28d0 >>>> :: Evt-fct-mbrs: 3 >>>> :: fct-mbr[0][Event] - ctx [0x6033b8] stub-fct[0x401960] >>>> :: fct-mbr[1][IsA] - ctx [0x11c3910] stub-fct[0x7f9892ed2290] >>>> :: fct-mbr[2][ShowMembers] - ctx [0x11c3910] stub-fct[0x7f9892ed1d00] >>>> >>>> ie: the correct address for both the context pointer and the stub >>>> function (calling resp. Member::Stubcontext() and Member::Stubfunction()) >>>> >>>> but when the ctor_Event function is invoked: >>>> ::ctor-fct[Event] [(nil)] [0x13b3500] [0x11c85d0] [(nil)] >>>> >>>> the ctx pointer is always NULL, eventhough FunctionMember::Invoke does >>>> pass the fStubCtx to fStubFP: >>>> >>>> // parameters need more checking FIXME >>>> fStubFP(retaddr, mem, paramList, fStubCtx); >>>> >>>> >>>> (I'd like to use that context pointer to pass a few extra informations >>>> needed for the proper initialization of the Go runtime when >>>> instantiating the struct instance...) >>>> >>>> am I doing something wrong ? >>>> >>>> -s >>>> >> >> -- >> ######################################### >> # Dr. Sebastien Binet >> # Laboratoire de l'Accelerateur Lineaire >> # Universite Paris-Sud XI >> # Batiment 200 >> # 91898 Orsay >> #########################################
This archive was generated by hypermail 2.2.0 : Fri May 20 2011 - 05:50:02 CEST