Fergus Henderson wrote:
> [...] For prior art, see the `Interfaces.C' package in normative
> Annex E of the Ada 95 standard (available via www.ada.org).
My Ada is a little bit rusty, but what I've understood from
http://lglwww.epfl.ch/Ada/rm95/rm9x-B-03.html is the following:
* Interfaces.C contains different types for "normal" and wide
characters/strings plus some conversion routines from/to their
C representations. Is the exact mapping specified? Don't know...
* Records can be passed as pointers to structs, but the exact
mapping is not specified. If one thinks that this is trivial,
what are the byte offsets of c2 and i in the following C examples?
struct _foo {
char c1;
struct _bar {
char c2;
int i;
};
} foo;
struct _foo {
char c1;
char c2;
int i;
} foo;
This behaviour is a little bit tricky to specify. In any case,
passing compound Haskell values should be handled by a library
and not by foreign import/export itself.
* Interfaces.C.Strings is similar to module PackedString.
* Interfaces.C.Pointers is similar to module FFI.
So what remains is basically the first item. Could somebody make a
detailed proposal how the FFI should handle this character/string
stuff?
Cheers,
Sven
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne