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
Use of external functions alone does not cause module to be linked #2471
Comments
Comment author: administrator Xavier Leroy writes:
This worked perfectly for me.
You are welcome!
Thanks!T. Kurt Bond, tkb@tkb.mpl.com |
Comment author: administrator
Right, this is a bug. It is fixed in the working sources. If you Thanks for the bug report,
Index: csl/bytecomp/bytelink.ml -(* $Id: bytelink.ml,v 1.55 2000/04/20 14:39:01 doligez Exp $ ) (* Link a set of .cmo files and produce a bytecode executable. *) @@ -129,6 +129,7 @@
@@ -142,7 +143,6 @@
|
Comment author: administrator Fixed on 2000-06-05 by Xavier |
Original bug ID: 129
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I've run into what seems to be a small bug.
I'm using the ocaml-3.00 under Redhat 6.2; I've tried this using
both OCaml installed from ocaml-3.00-2.rh61.i386.rpm and from an
OCaml I I built from source.
It appears that if you use a "external" function from a library,
without using any other normal values (like regular functions) from
that library, the O'Caml linker does not include that library's
auto-link C libraries in the final link, preventing the executable
from being built.
I don't think this behavior is documented anywhere.
There are three simple workarounds: add -cclib -llibrary to the link
command, or add -linkall, or use some normal value from that
library.
I've included some examples below, in the form of a shell script
that creates some source files and tries to compile them. The
examples are admittedly contrived, but do illustrate the problem.
Start of shell script with examples
set -x
Example using Str
cat >bug.ml <<'EOF'
let x = Str.search_forward
let _ =
print_endline "this program shows the bug!"
EOF
echo This fails
ocamlc -verbose -o bug -custom str.cma bug.ml
echo This succeeds, since we add -linkall
ocamlc -verbose -linkall -o bug -custom str.cma bug.ml
Example using Dbm
cat >bug2.ml <<'EOF'
let d = Dbm.close
let _ =
print_endline "this program also shows the bug!"
EOF
echo This fails
ocamlc -verbose -o bug2 -custom dbm.cma bug2.ml
echo This succeeds, since we add -linkall
ocamlc -verbose -linkall -o bug2 -custom dbm.cma bug2.ml
This example works; Str.regexp is not an "external" function.
cat >nobug.ml <<'EOF'
let x = Str.regexp
let _ =
print_endline "this program does not show the bug!"
EOF
echo This succeeds
ocamlc -verbose -o nobug -custom str.cma nobug.ml
End of shell script with examples
--
T. Kurt Bond, tkb@tkb.mpl.com
The text was updated successfully, but these errors were encountered: