[MLton-user] ffi question
Matthew Fluet
MLton-user@mlton.org
Tue, 6 May 2003 08:43:21 -0400 (EDT)
The simplest solution is to give XOpenDisplay the type string -> word,
since MLton words are 32bits. As you point out, this value is treated
abstractly, so you might isolate the XLib pointers from the rest of your
code in the following manner:
structure XLib:> sig
type display
val XOpenDisplay: string -> display
val XCloseDisplay: display -> unit
...
end =
struct
type display = Word32.word
val XOpenDisplay = _ffi "XOpenDisplay": string -> display;
val XCloseDisplay = _ffi "XCloseDisplay": display -> unit;
...
end
On Tue, 6 May 2003, Vesa A Norrman wrote:
> Hello, I was thinking to call XOpenDisplay from mlton. I wanted to
> write someting like
>
> val XOpenDisplay = _ffi "XOpenDisplay" : string -> pointer
>
> but there is not a pointer type available according to documentation
>
> u ::= bool | char | int | real | string | unit | word | word8
>
> XOpenDisplay returns a pointer to a structure (Display), but applications
> always treat this pointer opaque. An application only stores this pointer
> and passes is to other functions. What is the best type? Another question:
> is there a way (in ffi) to check if a pointer is 0. TIA Vesa
> --
> /`---*\
> = ^ o ^ =
> `-----'
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> MLton-user mailing list
> MLton-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mlton-user
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-user mailing list
MLton-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-user