[MLton] Callbacks
Mike Thomas
mike.thomas@brisbane.paradigmgeo.com
Fri, 16 Jan 2004 13:17:30 +1000
Hi Stephen.
| Indeed. This was a bug. I have checked in a fix. Hopefully you can
| remake the compiler by bootstrapping on Cygwin? That's how I build
| the Cygwin package these days.
Thanks, as usual, for the quick bug fix. Built a new Cygwin mlton in
roughly 1 1/2 to 2 hours after removing the doc target on a 2.4GHz PIV with
512 Mb and oddles of disk. The build does bring all other processes to a
grindingly slow pace (partial window redraws etc.)
I had to download the Cygwin GMP library using the Cygwin setup program.
While linking my tests I got a bunch of unresolved GMP imports :
mlton -link-opt -L/lib/w32api -link-opt -lglut32 -link-opt -lglu32 -link-opt
-lo
pengl32 shortest.cm Gl_c.c Glut_c.c
/usr/lib/mlton/self/libmlton.a(gc.o)(.text+0x54dd):gc.c: undefined reference
to
`__imp____gmpn_set_str'
etc
Renaming the old libgmp provided with MLton removed those errors but the
executables no longer startup - a requestor with "Application failed to
initialise properly (0xc0000005)". The dependecy on the GMP DLL seems to be
OK as the DLL is in the path and the depends tool picks it up, so I don't
know what is going on.
Is there some special version of libgmp which you are using on Cygwin?
Cheers
Mike Thomas
|
| > =====================================================================
| > C API:
| > GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK
| *func)(unsigned
| > char key, int x, int y));
| >
| > SML Side:
| > (*fun glutKeyboardFunc (kbd: char * int * int -> unit) = ( gKbdFA kbd;
| > callGKbdF ())*)
| > (* Special function callback *)
| > val gSpecFA = _export "glutSpecialFuncArgument": int * int *
| int -> unit;
| > val callGSpecF = _import "callGlutSpecialFunc": unit -> unit;
| > =====================================================================
| >
| > which generates a C header with pointer type warnings.
|
| I can't reproduce the problem here. Are you talking about the C
| header generated by -export-header true?
Yes.
| Does that file have the
| warnings or is it when compiling another file? What are the pointer
| type warnings?
In the header output from MLton:
void glutDisplayFuncArgument ();
void glutIdleFuncArgument ();
void glutReshapeFuncArgument (Int32 x0, Int32 x1);
void glutKeyboardFuncArgument (Word8 x0, Int32 x1, Int32 x2);
void glutSpecialFuncArgument (Int32 x0, Int32 x1, Int32 x2);
While compiling the C which imports that header:
gcc -c GLUT_c.c
GLUT_c.c: In function `callGlutReshapeFunc':
GLUT_c.c:13: warning: passing arg 1 of `glutReshapeFunc' from incompatible
pointer type
GLUT_c.c: In function `callGlutKeyboardFunc':
GLUT_c.c:18: warning: passing arg 1 of `glutKeyboardFunc' from incompatible
pointer type
GLUT_c.c: In function `callGlutSpecialFunc':
GLUT_c.c:23: warning: passing arg 1 of `glutSpecialFunc' from incompatible
pointer type
And in glut.h:
# define GLUTCALLBACK __cdecl
# define APIENTRY __stdcall /* Actually defined in gl.h */
GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width,
int height));
GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned
char key, int x, int y));
GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int
x, int y));
Cheers
Mike Thomas.