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

-pack bug #2935

Closed
vicuna opened this issue Jul 13, 2004 · 2 comments
Closed

-pack bug #2935

vicuna opened this issue Jul 13, 2004 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 13, 2004

Original bug ID: 2935
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Matthew W. Boyd
Version: 3.08.0
OS: Windows XP
Submission from: 65.247.218.12 (65.247.218.12)

When I compile a library and that library has a functor in it, the result will
not link. I was compiling a set of modules into a single .cmx file and then
putting that .cmx file into a .cmxa, but when I try to link it with a file that
uses a functor defined in the .cmxa, I get a link error. For example:

mm.mli:

module M(S : sig val x : int end) :
sig
val f : int -> int
end

mm.ml:

module M(S : sig val x : int end) =
struct
let f y = S.x + y
end

mm_tst.ml:

module M = Nmm.Mm.M(
struct
let x = 3
end);;
Printf.printf "k = %d\n" (M.f 5);;
flush stdout;;

Compile with:

ocamlc -c mm.mli
ocamlopt -c mm.ml
ocamlopt -pack -o nmm.cmx mm.cmx
ocamlopt -a -o nmm.cmxa nmm.cmx
ocamlopt -o mm_tst.exe nmm.cmxa mm_tst.ml

The compiler reports:

mm_tst.o(.text+0x16):fake: undefined reference to `_camlMm__M_62'
collect2: ld returned 1 exit status
Error during linking

@vicuna
Copy link
Author

vicuna commented Aug 6, 2004

Comment author: administrator

Version: 3.08.0
OS: Windows XP

When I compile a library and that library has a functor in it, the
result will not link.

Do you remember which MS Windows port of OCaml you used? Cygwin,
MinGW, or MSVC + objcopy and nm from Cygwin? That would help me
reproduce and track down the problem. Thanks.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Aug 10, 2004

Comment author: administrator

Fixed 2004-08-10 by XL

@vicuna vicuna closed this as completed Aug 10, 2004
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant