_ffi and Windows stdcall symbols

Mike Thomas miketh@brisbane.paradigmgeo.com
Thu, 17 Jul 2003 17:21:58 +1000


Hi all.

Windows stdcall library entry points may be a problem as shown below.
Presumably either a different specifier is needed or the syntax of _ffi
should be extended - possibly to include a header file to obtain a
prototype.

Also on a related but more speculative note, maybe now is the best time to
rationalise the naming of _ffi and _export, perhaps to reflect whatever
standards might potentially be introduced in the forthcoming (unspecified
ETA, of course) SML/NJ compiler.  Compatibility of such extensions between
these compilers would really boost library binding portability and
availability I would expect.  Perhaps a lead could be taken from the Haskell
98 FFI Addendum?

Thanks for your ongoing help.

Mike Thomas.

======================================================================
$ make
mlton -lib-search /lib/w32api -link opengl32 import.sml
/c/DOCUME~1/miketh/LOCALS~1/Temp/fileypyV2t.o(.text+0x743):/c/DOCUME~1/miket
h/LO
CALS~1/Temp/filepUro78.0.S: undefined reference to `_glClear'
collect2: ld returned 1 exit status
call to system failed: gcc -o import
/c/DOCUME~1/miketh/LOCALS~1/Temp/fileMz4ReN
.o
/c/DOCUME~1/miketh/LOCALS~1/Temp/fileypyV2t.o -L/lib/w32api -L/usr/lib/mlton
/
self -lmlton -lopengl32 -lgdtoa -lm -lgmp
make: *** [import] Error 1

$ nm --defined-only --print-file-name /lib/w32api/libopengl32.a | grep
glClear

....blah blah....

/lib/w32api/libopengl32.a:ds00016.o:00000000 I __imp__glClear@4
/lib/w32api/libopengl32.a:ds00016.o:00000000 T _glClear@4