[plt-scheme] v299 FFI - callbacks, __stdcall?

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Oct 1 16:55:29 EDT 2005

[Replying to the list...]

On Oct  1, Sergey Shishmintzev wrote:
> please see  ffitarget.h:
> typedef enum ffi_abi {
>   FFI_FIRST_ABI = 0,
> 
>   /* ---- Intel x86 Win32 ---------- */
> #if defined(X86_WIN32) || defined(_MSC_VER)
>   FFI_SYSV, // !!!use this
>   FFI_STDCALL,  // !!!or this
>   /* TODO: Add fastcall support for the sake of completeness */
>   FFI_DEFAULT_ABI = FFI_SYSV, // !!!instead of ... (?)
> #endif

Duh!  I could have searched my own source for ABI...  Anyway, thanks
for opening my closed eyes.

The only problem is how to get it in sanely, so that I don't end up
with an exponential number of functions...  The best way I can think
of currently is an optional argument to `ffi-call' and `ffi-callback',
then make the _fun macro have these variants:

  (_fun itype ... -> otype)
  (_fun itype ... -sysv-> otype)
  (_fun itype ... -stdcall-> otype)

It seems to make sense, but I don't know how to deal with the fact
that not all ABIs are available on all platforms.

Any ideas and/or comments will be appreciated.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.