Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynlink and -output-obj do not work together #2391

Closed
vicuna opened this issue Mar 11, 2000 · 1 comment
Closed

Dynlink and -output-obj do not work together #2391

vicuna opened this issue Mar 11, 2000 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Mar 11, 2000

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.

@vicuna
Copy link
Author

vicuna commented Apr 18, 2004

Comment author: administrator

Wish granted (at last!) 2004/02/22 by XL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant