| Anonymous | Login | Signup for a new account | 2013-05-25 21:40 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004229 | OCaml | OCaml documentation | public | 2007-03-14 14:32 | 2012-09-14 23:52 | ||||||
| Reporter | frisch | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | 4.00.2+dev | Fixed in Version | |||||||||
| Summary | 0004229: Casser le typage avec Dynlink | ||||||||||
| Description | Dynlink autorise à charger un module déjà présent dans le programme principal ou déjà dynlinké avant (si sa signature est la même). En particulier, cela permet de redéfinir l'implémentation d'un type abstrait et donc de casser le typage. Certes, il faut vraiment le chercher (cf plus bas). Une solution un peu moche consisterait à empecher de cacher un symbole global. Dans symtable.ml: let slot_for_setglobal id = if Tbl.mem id !global_table.num_tbl then 0xffff else enter_numtable global_table id Dans interp.c: Instruct(SETGLOBAL): if (*pc != 0xffff) caml_modify(&Field(caml_global_data, *pc), accu); accu = Val_unit; pc++; Next; | ||||||||||
| Steps To Reproduce | abstract.mli: type t val print: t -> unit val x: t abstract.ml: type t = int let print i = Printf.printf "Abstract %i\n" i let x = 10 static.ml: let f = Abstract.print client.ml: let () = Static.f Abstract.x sub/abstract.mli = abstract.ml sub/abstract.ml: type t = string let print i = Printf.printf "Abstract %s\n" i let x = "foo" main.ml:let () = Dynlink.init (); Dynlink.loadfile "client.cmo"; (* utilise abstract.cmo *) Dynlink.loadfile "sub/abstract.cmo"; Dynlink.loadfile "client.cmo" (* utilise sub/abstract.cmo *) On compile tout ça... $ ocamlc -o main dynlink.cma abstract.cmo static.cmo main.cmo $ ./main Abstract 10 Abstract 67345600 | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Relationships |
|||||||||||
|
|||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-03-14 14:32 | frisch | New Issue | |
| 2007-11-10 13:52 | xleroy | Status | new => acknowledged |
| 2009-07-22 09:19 | frisch | Relationship added | child of 0004839 |
| 2009-07-22 09:19 | frisch | Relationship added | related to 0004231 |
| 2009-07-22 09:19 | frisch | Relationship deleted | child of 0004839 |
| 2009-07-22 09:19 | frisch | Relationship added | related to 0004839 |
| 2012-07-11 16:11 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-31 13:37 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-14 23:52 | doligez | Target Version | 4.00.1+dev => 4.00.2+dev |
| Copyright © 2000 - 2011 MantisBT Group |