You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a OCaml program which is embedded in another (C) program; I did
this by using the -output-obj option of the (bytecode) compiler. This
alone works fine; but if I try to initialize the Dynlink library (calling
Dynlink.init), the runtime system wants to read the bytecode executable
again to get the symbol table. The code in Symtable.init_toplevel reads
the file in argv.(0) and interprets it as bytecode executable. Of course,
in my program it is impossible to read such an executable because there
is not any.
I use currently a hack to get around this limitation: I wrote a shell script
that outputs the list of primitives to stdout; I built a "pseudo executable"
using ocamlc -use-runtime /name/of/shellscript. That way, the produced bytecode
should be identical, and the executable contains a symbol table. Finally,
I set Sys.argv.(0) to the path of the pseudo executable before invoking
Dynlink.init.
I think it is much better to repair the runtime system; the -output-obj
option could also force the compiler to put a symbol table into the generated
object file, and Dynlink.init should be able to read this symbol table.
The text was updated successfully, but these errors were encountered:
Original bug ID: 54
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Gerd Stolpmann
Version: 2.04
OS:
Submission from: master.proxy.ision.net (195.180.208.40)
Hi,
I have a OCaml program which is embedded in another (C) program; I did
this by using the -output-obj option of the (bytecode) compiler. This
alone works fine; but if I try to initialize the Dynlink library (calling
Dynlink.init), the runtime system wants to read the bytecode executable
again to get the symbol table. The code in Symtable.init_toplevel reads
the file in argv.(0) and interprets it as bytecode executable. Of course,
in my program it is impossible to read such an executable because there
is not any.
I use currently a hack to get around this limitation: I wrote a shell script
that outputs the list of primitives to stdout; I built a "pseudo executable"
using ocamlc -use-runtime /name/of/shellscript. That way, the produced bytecode
should be identical, and the executable contains a symbol table. Finally,
I set Sys.argv.(0) to the path of the pseudo executable before invoking
Dynlink.init.
I think it is much better to repair the runtime system; the -output-obj
option could also force the compiler to put a symbol table into the generated
object file, and Dynlink.init should be able to read this symbol table.
The text was updated successfully, but these errors were encountered: