[MLton] FFI: C void *

Mike Thomas mike.thomas@brisbane.paradigmgeo.com
Thu, 15 Jan 2004 11:42:14 +1000


Hi Stephen.

Thanks for that! Test 2 (hello.sml) now works as far as the pretty picture
is concerned, but has the same problem as the other test I mentioned to you
separately - the failure of the GLUT main loop callback to return properly -
a minor problem!

The only doc I could find regarding FFI pointers was in the FFI section
which talks about these types being equivalent.

SML type 	C typedef 	C type
array 	Pointer 	char *

I've now found the MLton extensions section with Pointer et al.

I imagined erroneously that the function pointer was just a value to be
brought back and then returned.

Cheers

Mike Thomas.

| -----Original Message-----
| From: mlton-admin@mlton.org [mailto:mlton-admin@mlton.org]On Behalf Of
| Stephen Weeks
| Sent: Wednesday, 14 January 2004 4:52 PM
| To: MLton@mlton.org
| Subject: [MLton] FFI: C void *
|
|
|
| The correct way to import the C function
|
| > Pointer mlton_glut_stroke_roman(void)
| > {
| >   return ((Pointer) GLUT_STROKE_ROMAN);
| > }
|
| is
|
| val GLUT_STROKE_ROMAN =
|    _import "mlton_glut_stroke_roman" : unit -> MLton.Pointer.t;
|
| _______________________________________________
| MLton mailing list
| MLton@mlton.org
| http://www.mlton.org/mailman/listinfo/mlton
|
|