[MLton-devel] Re: release of MLton with MLton.Finalizable and _export
Ken Friis Larsen
kfl@it.edu
04 Jul 2003 21:37:12 +0100
Hi Stephen,
Sorry for taking so long to get back to you, but I only just returned
from vacation.
> I wanted to point you at our latest experimental release of MLton,
> 20030625, available at http://www.mlton.org/experimental/.
Cool. Because I can't compile MLton from CVS these days. I get the
following error:
---
[kfl@vips mlton]$ make
make all
make[1]: Entering directory `/home/kfl/programming/ml/mlton'
make compiler dirs
make[2]: Entering directory `/home/kfl/programming/ml/mlton'
make -C /home/kfl/programming/ml/mlton/mlton
make[3]: Entering directory `/home/kfl/programming/ml/mlton/mlton'
rm -f front-end/ml.grm.*
mlyacc front-end/ml.grm
1 shift/reduce conflict
chmod -w front-end/ml.grm.*
rm -f front-end/ml.lex.sml
mllex front-end/ml.lex
Number of states = 335
Number of distinct rows = 221
Approx. memory size of trans. table = 228072 bytes
chmod -w front-end/ml.lex.sml
Compiling mlton (takes a while)
mlton @MLton gc-summary -- -host self -verbose 1 -output mlton-compile mlton-stubs.cm
MLton 20030625 (built Thu Jul 3 14:33:14 2003 on vips)
MLton starting
Compile SML starting
pre codegen starting
pre codegen raised in 0.06 + 0.00 (0% GC)
Compile SML raised in 0.06 + 0.00 (0% GC)
MLton raised in 0.21 + 0.00 (0% GC)
newIn ../lib/mlton-stubs/int-inf.sml: No such file or directory
---
I guess it is a case of not getting the mlton-stub files updated like
last time.
But the 20030625 snapshot compiles without problems, so no problemo :-)
> This release has the MLton.Finalizable module that we discussed a
> while back.
Meanwhile I've been using it in anger in another project, but I'll get
back to that in an other mail (possibly not until the end of next week).
> It also includes our latest attempt at providing a facility for
> calling SML from C. Now in SML you can say
>
> _export "foo": real * char -> int;
>
> to export a function "foo" for calling from C. See the user guide for
> details.
Super cool.
> How goes the mGTK port?
Today, I managed to open my first window with a button using the mlton
port :-)
But I get a strange error as soon as I click the button:
unhandled exception: Thread.atomicEnd with no atomicBegin
(or if I do anything else that will result in an SML callback being
called). Any idea what I'm doing wrong, or how to debug this?
If you want to play with the current code I've placed a snapshot here:
http://www.it.edu/people/kfl/tmp/mini-gtk.tgz
or you can peek in our CVS:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mgtk/mgtk/mini-gtk
To compile the helloworld example I use the following command:
mlton -output helloworld -verbose 2 helloworld-mlton.cm \
-I/home/kfl/programming/ml/mlton-20030625/install/usr/lib/mlton/self/include\
`pkg-config --cflags gtk+-2.0` mgtk-mlton.c `pkg-config --libs gtk+-2.0`
For the new export functionality I have the following comments and
questions:
* It is really annoying the exported .h is named the same as the
first .cm or .sml file. Because it means that I have to make a
new mgtk-mlton.c file for each program that uses mgtk. We would
like to distribute mgtk as a bunch of .sml files an single .c file
and a .cm file. How can we do that?
* Why do I have to supply the long -I flag with the path to mlton
myself? (Or perhaps my real question is, am I invoking mlton the
right way above?)
* If you search for GValue in MiniGtk-mlton.sml you'll find the
following code segment:
type GValues = word
type GValue = word
I first wrote this as:
type GValues = MLton.pointer
type GValue = MLton.pointer
But then I get the error:
MiniGtk-mlton.sml:153.10-154.72
Error: invalid type for exported function:
((int32 * pointer * pointer * int32) -> unit)
Why?
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel