[MLton-devel] mGTK for MLton status

Stephen Weeks MLton@mlton.org
Sat, 16 Aug 2003 13:56:26 -0700


> we probably ought to change mlton to accept it.  In the short run, you can
> replace
> `pkg-config --libs gtk+-2.0`
> with
> `pkg-config --libs-only-l gtk+-2.0`

I agree that this is the best fix for now.  My suggestion of using
"-cc-opt -Wl,--export-dynamic" doesn't help because with -cc-opt,
MLton passes the option to gcc when compiling but not when linking.

> We could generate a call to gcc with all the "rest" options and
> check to see if gcc returns an unrecognized option error.  Of
> course, I can't seem to find an option that will do nothing but
> check the validity of the options.

Rather than trying to check the validity of the options in MLton as we
do now or calling gcc and have it check, I think the best fix is to
add a new switch, -link-opt, that is the analog of -cc-opt and passes
the option when calling gcc as the linker.

> This way there is no confusion possible and you can pass
> any thing.  (One uglyness is that if you want to pass, or instance,
>	-letter value
> to gcc, you would have to do
> 	-gcc -letter -gcc value
> but atleast everything can be done.)

Actually, -cc-opt '-letter value' works fine.  Handling -link-opt in
the same way means that Ken can now build his executable by passing
the following flag to MLton

	-link-opt "`pkg-config --libs gtk+-2.0`"

That looks good to me.

On a related note, with -link-opt we no longer need the -link or
-lib-search options for MLton.  I think it might be good to get rid of
them.  They are easily replaced.

	old			new
	----------------	------------------
	-link foo		-link-opt "-lfoo"
	-lib-search path	-link-opt "-Lpath"

Even better, "-lib-search path -link foo" becomes "-link-opt '-Lpath
-lfoo'".  We also no longer need to support the ability to pass linker
args after the .sml file.  It might be good to get rid of that too,
and force people to use -link-opt.  Thoughts?

BTW, Ken, I noticed that in mgtk-mlton.c you include mgtk-mlton.h,
which appears to have been partially generated by hand.  The intended
way to do this with mlton is to call

	mlton -export-header true mgtk.cm >mgtk-mlton.h

to generate the header.

I didn't know if you were unaware of this, or had encountered some
problem.  If the latter, we'd like to hear about it.



-------------------------------------------------------
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/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel