[gambit-list] working with ___arg* variables in c interface
Stephane Le Cornec
coleste at videotron.ca
Sun Sep 9 12:21:43 EDT 2007
The short answer is:
#define ___arg1 ___CFUN_CAST(OSVERSIONINFOW*,___arg1_voidstar)
which expands to
(OSVERSIONINFOW*)(___arg1_voidstar)
At 03:08 -0400 2007/09/09, James Long wrote:
>In a c-lambda, what are the types of the argument variables ___arg1,
>___arg2, and so on? It seems like they are statically resolved to the
>types I passed in to the c-lambda, and everything happens that I
>expect to happen:
>
>(define %%addOne
> (c-lambda (int) int "___result=___arg1+1;"))
>
>(display (%%addOne 10))
>
>This correctly prints out 11, and other various operations on pointers
>seemed to work too. For example, if 'ctx' is a structure with a 'id'
>field, and 'ctxp' is defined as (pointer ctx), the following function
>works fine:
>
>(define %%useCtx
> (c-lambda (ctxp) int "___result=(*___arg1).id;"))
>
>Basically, my question is when do I need to use ___CAST on the
>argument variables? Is it something I should be doing most of the
>time for safety, to suppress warnings or for some other reason? Or is
>it something done in a special case I haven't encountered yet? I've
>seen it done in other gambit FFI's and I'm wondering if the other was
>just paranoid or something (and if I should be).
>_______________________________________________
>Gambit-list mailing list
>Gambit-list at iro.umontreal.ca
>https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
--
Stephane!
coleste at videotron.ca (Stephane Le Cornec)
+------------------- Made with recycled electrons. --------------------+
| #include <disclaimer.h> Kebekkujin desu. |
+----------------------------------------------------------------------+
More information about the Gambit-list
mailing list