help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re : Re : [Help-smalltalk] How to convert a Cobject in C


From: Mathieu Suen
Subject: Re : Re : [Help-smalltalk] How to convert a Cobject in C
Date: Tue, 24 Aug 2010 11:37:43 +0000 (GMT)


> > De : Paolo Bonzini <address@hidden>

> > On 08/24/2010  11:05 AM, Mathieu Suen wrote:
> > >
> > > Hi,
> > >
> >  >  I got on object in C that come from smalltalk.
> > > It is a  subclass of a  CStruct.
> > >
> > > Now in the VM I got an  OOP.
> > > How do I get back  the C structure.
> > 
> >  vmProxy->OOPToCObject, or gst_oop_to_cobject,  depending on whether 
> > you're in a module or you're the one linking to  libgst.
> > 
> > > I am not inside a cCall or a primitive.
> > 
> > Where  are  you? :)
> 
> :) 
> I am inside the _gst_send_message_internal.
> I  go look how  OOPToCObject is implement.

So I used the _gst_oop_to_c_object but my object have one more instance 
variable:

CStruct subclass: CJitState [
     | codeBuffer |
     ...snip...
]

So the function _gst_oop_to_c_object does not return the expected structure. 
Instead I have one more
field in the structure.
So the cast don't work in C:

stack = (jit_stack*)_gst_oop_to_c_object(jitMethod->jitState);

What is the proper way of dealing with that?

I could just use:
(jit_stack*)_gst_oop_to_c_object(jitMethod->jitState)+1;

But don't know if is it a good idea.

Thanks


> 
> 
> Thanks
> 
> > 
> > Paolo
> > 
> 
> 
> _______________________________________________
> help-smalltalk  mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
> 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]