hello

I am calling a terra function from C and using the returned value later in
the C source.
The terra function is

terra testme(a:Rbase.SEXP)
   var a1 : RealVector = rv.salloc():init(a)
   return(a1)
end

where

struct RealVector(R.Object)
{
   _sexp : R.SEXP;
   _ptr  : &double;
   _length : uint64;
}
(neither the salloc or init do any memory allocation)

So when i call testme from C, i get a CDATA data structure(
cdata<struct RealVector_1 *>: ). I
imagine


      const void *p = lua_topointer (L,-1); // L is LuaState after
'testme' returns
      a = *((SEXP *)p);

I imagine 'a' will now point to the '_sexp'  member of the returned
struct.

Is this expectation correct? Or do terra structs get padded?

Regards
Saptarshi
_______________________________________________
terralang mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/terralang

Reply via email to