I hit the MLton-wall! :)

Anoq of the Sun anoq@HardcoreProcessing.com
Wed, 24 Jan 2001 14:40:40 +0100


Hello!


I have now hit the MLton-wall with a software
project. The project is about 23.000 lines of
ML code... It compiles just fine under Linux,
but when crosscompiling to Windows the
assembler can't handle the .o files generated
from gcc:

/usr/local/cross-tools/lib/gcc-lib/i386-mingw32msvc/2.95.2/
../../../../i386-mingw32msvc/bin/as: /tmp/filevwWFG6.o:
reloc overflow: 0x12989 > 0xffff
/tmp/filevwWFG6.o: File truncated
/tmp/ccSD5Knj.s: assembler messages:
/tmp/ccSD5Knj.s:463847: FATAL: Can't close /tmp/filevwWFG6.o:
File truncated
Error: call to system failed: gcc -c [etc.]

I removed (disabled) a large chunk of the
program and got it down to 14.000 lines -
which worked fine of course, and that binary
is almost 1.2 MB on Windows.

Do you know of any solutions to this?
Like splitting up the generated code into
smaller pieces? The software-project is quite
well-structured, so it's quite easy to split
based on the project and files.

Also - it happened when adding just a few more lines
of code, so I'm not sure if some of the few differences
in the Windows vs. Linux runtime system makes the
difference - and that a similar limit on Linux is
close...

I'll also send mail to the Mingw32 people about
this...


And by the way - speaking of splitting into
smaller pieces - it would be _really_ great if
it was possible to create binary library files
with MLton that could be linked with.
Preferably dynamic linking (.so files on Linux
and .dll files on Windows) :)

I guess the main problems to be solved are:
1) Generate the library with MLton
2) Load and use libraries with MLton
3) Getting garbage-collection to work
   across the library boundaries.

I know that MoscowML can load and use dynamic
libraries, and that code seems quite simple -
so I don't think that would be too hard to
port to MLton :)

1) and 3) doesn't seem like huge problems to
me either - but I guess it would be vital to
do 3) The Right Way (TM). Maybe some kind of
standard already exists for doing GC across
library boundaries? Since GC-languages
are getting quite common now a days...

Maybe it's worth a post on comp.lang.ml :)

...Hey! I just got an idea! :)
Problem 3) Could be solved by putting the
GC in a library! Then all libraries as well
as the main program could just load
that - then users could even choose
their own GC, if several existed! ;)
I'm sure that would be do-able :)


Cheers
-- 
http://www.HardcoreProcessing.com