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
Link multiple casse le système de types #4231
Comments
Comment author: @alainfrisch On peut faire pareil avec ocamlopt, mais il faut ruser un peu plus à cause (grace?) au test "Files ... and ... both define a module named ...". Heureusement, -pack est là pour nous sauver ! abstract.mli = sub/abstract.mli: abstract.ml: sub/abstract.ml: api.ml: x.ml = sub/x.ml: compilation: |
Comment author: @alainfrisch Après discussion avec Nicolas et Benoit, proposition: (1) interdire (comme le fait déjà ocamlopt) de linker deux modules avec le même nom; (2) interdire le -pack si un des modules packés dépend d'un .cmi d'un module non packé dont la signature mentionne un des modules packés (dans l'exemple, le x.cmo packé dépend de api.cmi, dont la signature mentionne Abstract; or on packe un module de nom Abstract, d'où risque de collision). Je pense que ça suffit. |
Comment author: @alainfrisch As far as I can see, #5461 fixes only the bytecode case. In one the notes here, I give an example with ocamlopt, using -pack. |
Original bug ID: 4231
Reporter: @alainfrisch
Assigned to: @lefessan
Status: closed (set by @xavierleroy on 2013-08-31T10:44:13Z)
Resolution: duplicate
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #5461
Related to: #4229 #4839 #5473 #6462 #6950 #6957
Monitored by: @glondu @jmeber "Julien Signoles" @Chris00 ertai @alainfrisch
Bug description
Variante de l'autre bug d'hier, cette fois sans Dynlink...
Steps to reproduce
abstract.mli = sub/abstract.mli:
type t
val x: t
val f: t -> unit
abstract.ml:
type t = int
let x = 10
let f x = Printf.printf "Abstract 1 : %i\n" x
api.ml:
let r : Abstract.t list ref = ref []
x.ml:
let () = Api.r := Abstract.x :: !Api.r; List.iter Abstract.f !Api.r
sub/abstract.ml:
type t = string
let x = "foo"
let f x = Printf.printf "Abstract 2 : %s\n" x
$ ocamlc -c abstract.mli abstract.ml sub/abstract.mli sub/abstract.ml api.ml x.ml
$ ocamlc -o main abstract.ml api.ml x.ml sub/abstract.ml x.ml
$ ./main
zsh: segmentation fault ./main
The text was updated successfully, but these errors were encountered: