[Prev][Next][Index][Thread]
Re: FFI questions
-
To: info-dylan@ai.mit.edu
-
Subject: Re: FFI questions
-
From: Chris Double <chris@double.co.nz>
-
Date: Fri, 19 May 2000 21:45:02 -0400 (EDT)
-
Organization: None.
-
References: <200005192315.TAA15410@life.ai.mit.edu>
-
Sender: unknown@DOUBLE
-
User-Agent: Gnus/5.070099 (Pterodactyl Gnus v0.99) Emacs/20.6
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12039
Nolan Darilek <nolan_d@bigfoot.com> writes:
> Second, how are enums and bitfields handled?
Enums can be mapped to constants. Or maybe to a one-of()
definition. I'm not sure what the standard approach is.
Bitfields are described in section 1.6.3 of the C-FFI and Win32
Reference for Functional Developer. It talks about the 'slot' accessor
of a c-struct:
"A slot-spec has the following syntax:
[slot-adjective] slot getter-name :: c-type #key setter
address-getter c-name length width
The slot-adjective can be either array or bitfield. The array slot
adjective indicates that the slot is repeated and the dimensions
option is used to indicate how many repetitions are defined, and how
it is accessed. The bitfield slot adjective indicates that the slot
is really a bitfield. If bitfield is given then the width option
must also be given. The c-type given for a bitfield slot must be an
integer designator. The c-type for a bitfield slot indicates how the
value is interpreted in Dylan by the slot accessor. A slot may not
be specified as both an array and a bitfield."
> And, when subtyping, how do I create pointer designator classes?
Have a look at section 1.6.1 of the C-FFI reference. There is a
'pointer-type-name' option you can pass to define c-subtype:
define C-struct <_Matrix-struct>
slot rank :: <C-int>;
slot dimensions :: <C-int*>;
slot values :: <C-int*>;
pointer-type-name: <_Matrix-struct*>;
end C-struct;
> And, assuming I can tackle these issues, are there any Fun-O users who
> would be interested in helping me tackle the portability issues, as
> well as actually testing the produced FFI, since all I can do locally
> is eyeball it for obvious mistakes? Portability should be rather
> clean; my only concern is locating standard include files under
> windows compilers..
I'd be happy to test anything that you produce. I'm love to see a
working Pidgin!
Chris.
--
http://www.double.co.nz/dylan