Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] The Bytecode Interpreter...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] The Bytecode Interpreter...
Ok, so let me see if I can understand this all correctly. Let's assume
a linux-like environment.

When I compile a bytecode application, it uses the #! thing to execute
ocamlrun, with the app itself (I presume this is bytecode) following.
And this action is the exact same as typing: ocamlrun <bytecodeapp> at
the commandline instead of just ./<bytecodeapp>, right?

Then, the startup code in the bytecode interpreter (ocamlrun) tries to
load itself .. and if it turns out to be the interpreter itself, it
searches for the app as the command line argument, and opens that,
else opens itself (when invoked directly, not via ocamlrun), so that
it can access the bytecode in the file.

At this stage, we 1) don't need dlopen anywhere, and 2) only need
ocamlrun application somewhere for it to be executed.

If I were to use the toplevellib.cma, I'd then need dlopen; however,
the rest of the application flow is exactly the same, correct?

So, to get bytecode running on the bare metal, I'd just need to
implement some libc functionality for ocamlrun, possibly try tell
ocamlc to generate a different #! path to ocamlrun, and be able to
open the bytecode app file using fopen.

This is actually starting to sound doable ;-) Thank you all for your
valuable input to help me learn the intricacies of the ocaml bytecode
interpreter =)

Kindest Regards,

Jonathan Roewen