2010/3/30 Marc Feeley feeley@iro.umontreal.ca
On 2010-03-30, at 10:39 AM, Bradley Lucier wrote:
I believe you can use something like
___CAST(___sU8VECTOR*,___BODY_AS(obj,___tSUBTYPED))
The first argument to ___CAST must be a type... but ___sU8VECTOR is the subtype tag (an integer constant). So you want:
___CAST(___U8*,___BODY_AS(obj,___tSUBTYPED))
because ___U8 is defined as an unsigned char (on most platforms) by gambit.h .
Marc
Yes. I've tried all methods and they all work. Assuming that the third argument is the u8vector:
void *u8vectorptr = ___CAST(void*,&___FETCH_U8(___BODY(___arg3),___INT(0))); void *u8vectorptr = ___CAST(void*,&___FETCH_U8(___arg3,0)); void *u8vectorptr = ___CAST(___U8*,___BODY_AS(___arg3,___tSUBTYPED)); void *u8vectorptr = ___CAST(void*,___BODY(___arg3));
They all can be cast to uchar* directly:
unsigned char *u8vectorptr = ___CAST(___U8*,___BODY_AS(___arg3,___tSUBTYPED));
All produce the result I expect (apparently).
Thanks a lot for all your explanations. I'd like to put this in the wiki page:
http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Using_Gambit_with_Exte...
is that ok?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list