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 toplevel #2667

Closed
vicuna opened this issue Jun 12, 2004 · 2 comments
Closed

dynlink and toplevel #2667

vicuna opened this issue Jun 12, 2004 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 12, 2004

Original bug ID: 2667
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: otherlibs

Bug description

Full_Name: James Scott
Version: 3.07+2
OS: Linux and Windows
Submission from: d80-170-139-232.cust.tele2.fr (80.170.139.232)

When using Dynlink from the Toplevel:

Modules which are loaded by #load or given on the command line are not resolved
from Dynlink-loaded code.

e.g.

$ cat Loader.ml
let dynload_helper_ref = ref (None: int option)

let doit fname =
let _ = Dynlink.init () in
let _ = Dynlink.loadfile fname in
!dynload_helper_ref

$ cat Loadee.ml
Loader.dynload_helper_ref := Some 1

$ cat Test.ml
let _ = Loader.doit "Loadee.cmo" ;;

$ ocamlc -c Loadee.ml
$ ocamlc -a -o llib.cma Loader.ml
$ ocaml dynlink.cma llib.cma Test.ml
Exception:
Dynlink.Error
(Dynlink.Linking_error ("Loadee.cmo", Dynlink.Undefined_global "Loader")).

But this works:

$ ocamlmktop dynlink.cma llib.cma
$ ./a.out < Test.ml
Objective Caml version 3.07+2

- : int option = Some 1

@vicuna
Copy link
Author

vicuna commented Jun 15, 2004

Comment author: administrator

the example is not good, but the point is valid -DD 2004-06-15

@mshinwell
Copy link
Contributor

This is a known deficiency and I believe there is now a proper error message.

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

2 participants