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
Original bug ID: 1602 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: chris quinn
Version: 3.06
OS: linux
Submission from: 212.42.169.63 (212.42.169.63)
if a module Y to be loaded depends on the module X doing the loading
(init,loadfile),
there is a complaint:
"error while linking y.cmo.
The module `X' is not yet initialized"
which seems curious given that X is up and running.
before i found that making Y independent of X did the trick i
tried loadfile "x.cmo" before the load of y, and this resulted in a segfault.
about the path argument to [add_interfaces]: it had to include the standard
library path, and i thought of using Config.standard_library but unfortunately
this is internal to the compiler. if there is not something else i can use,
would it not be useful to make at least some of the ocaml configuration
available to the programming environment?
thanks
chris
x.ml-----------
class k = object
method init : unit = assert false
end
let reg = ref (new k)
let _ =
try
Dynlink.init();
Dynlink.add_interfaces
["X";"Dynlink";"Digest";"Y";"CamlinternalOO";"Pervasives"]
["";"/home/cq/programming/projects/SA-MetaTool/lib/ocaml"];
Dynlink.loadfile "y.cmo";
!reg#init;
with
| Dynlink.Error z -> print_endline("ERROR: "^Dynlink.error_message z)
y.ml--------------
class k = object
method init : unit = print_endline "Y registered"
end
if a module Y to be loaded depends on the module X doing the loading
(init,loadfile),
there is a complaint:
"error while linking y.cmo.
The module `X' is not yet initialized"
which seems curious given that X is up and running.
... but not yet fully initialized: a module is not fully initialized
until all its initialization code (the "let _ = ... " part of your example)
has completed.
before i found that making Y independent of X did the trick i tried
loadfile "x.cmo" before the load of y, and this resulted in a
segfault.
This should fail more cleanly :-) I'll see what I can do about it.
about the path argument to [add_interfaces]: it had to include the
standard library path, and i thought of using
Config.standard_library but unfortunately this is internal to the
compiler. if there is not something else i can use, would it not be
useful to make at least some of the ocaml configuration available to
the programming environment?
In the long run, probably yes. But the Dynlink.add_interfaces API
is poorly designed. In the working sources, new functions were added
to Dynlink to make it unnecessary to load interfaces from .cmi files.
(These can now be found in the running executable itself.)
Original bug ID: 1602
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: chris quinn
Version: 3.06
OS: linux
Submission from: 212.42.169.63 (212.42.169.63)
if a module Y to be loaded depends on the module X doing the loading
(init,loadfile),
there is a complaint:
"error while linking y.cmo.
The module `X' is not yet initialized"
which seems curious given that X is up and running.
before i found that making Y independent of X did the trick i
tried loadfile "x.cmo" before the load of y, and this resulted in a segfault.
about the path argument to [add_interfaces]: it had to include the standard
library path, and i thought of using Config.standard_library but unfortunately
this is internal to the compiler. if there is not something else i can use,
would it not be useful to make at least some of the ocaml configuration
available to the programming environment?
thanks
x.ml-----------
class k = object
method init : unit = assert false
end
let reg = ref (new k)
let _ =
try
Dynlink.init();
Dynlink.add_interfaces
["X";"Dynlink";"Digest";"Y";"CamlinternalOO";"Pervasives"]
["";"/home/cq/programming/projects/SA-MetaTool/lib/ocaml"];
Dynlink.loadfile "y.cmo";
!reg#init;
with
| Dynlink.Error z -> print_endline("ERROR: "^Dynlink.error_message z)
y.ml--------------
class k = object
method init : unit = print_endline "Y registered"
end
let _ =
X.reg:= new k
ocamlc -c x.ml
ocamlc -c y.ml
ocamlc -o test dynlink.cma x.cmo
The text was updated successfully, but these errors were encountered: