[MLton] Re: idea

Matthew Fluet fluet at tti-c.org
Wed Oct 31 17:51:48 PST 2007


It has been suggested before.  Ideally, there would be a simple way to 
incorporate a resource fork into an executable, then open that resource 
as a file to load the world.  Then one would simply need to abstract the 
word loading code to the point where it was loading from a file handle.

I think the difficult part would be the fact that the process of opening a 
resource from an executable (and adding a resource to an executable) will 
probably be different on each platform.  I know that Windows has such a 
mechanism, but I don't know of a corresponding feature on Unix platforms.

On Wed, 31 Oct 2007, Vesa Karvonen wrote:
> If I'm reading the code right, the code for loading a world (at
> initialization time --- I think that there were some issues with
> loading a world in MinGW
> (http://mlton.org/pipermail/mlton-user/2007-June/001126.html)) lives
> in runtime/gc/world.c.  To me it looks pretty straightforward code, so
> modifying it probably wouldn't be very difficult.  The main problem I
> see is that, AFAIK, the way you access resources in Windows is through
> an API that eventually gives you a void pointer to the raw data in
> memory.  OTOH, the code for loading a world assumes that it is reading
> the data from a file.  So, one would need to introduce a bit of
> abstraction into the world loading code to make it possible to read
> from both a file and from a raw memory block.  Shouldn't be too hard.
>
> -Vesa Karvonen
>
> On Oct 31, 2007 1:53 PM, Dave Herman <dherman at ccs.neu.edu> wrote:
>> How hard do you think it would be to stick a World file inside of an
>> executable and create a MLton API for loading a resource out of an
>> executable, in addition to being able to load from a separate file? That
>> way it would be possible to generate self-contained executables with
>> cached computations.
>>
>> If it's just an issue of how to generate the executable, I can look into
>> the platform-specific API's for doing that.
>>
>> Thanks,
>> Dave
>
> _______________________________________________
> MLton mailing list
> MLton at mlton.org
> http://mlton.org/mailman/listinfo/mlton
>



More information about the MLton mailing list