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

difference between linking .cmx files and linking .cmxa files #3508

Closed
vicuna opened this issue Mar 3, 2005 · 2 comments
Closed

difference between linking .cmx files and linking .cmxa files #3508

vicuna opened this issue Mar 3, 2005 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 3, 2005

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

Bug description

Full_Name: Daniel Weil
Version: 3.08
OS: Windows
Submission from: 81.80.88.226 (81.80.88.226)

Why is there a difference between linking .cmx files and linking .cmxa files ?
When linking .cmxa files, it seems that some static values are ignored.

Given a file called "truc.ml" and containing the code :
open Printf
let _ =
printf "coucou\n"

Compile this program with :
ocamlopt -c truc.ml
ocamlopt -o truc.exe truc.cmx
truc.exe

This output is "coucou"

Compile the same program with :
ocamlopt -c truc.ml
ocamlopt -a -o truc.cmxa truc.cmx
ocamlopt -o truc.exe truc.cmxa
truc.exe

Nothing is printed!!!

Why ? Is it a bug ?

@vicuna
Copy link
Author

vicuna commented Mar 3, 2005

Comment author: administrator

Why is there a difference between linking .cmx files and linking
.cmxa files ? When linking .cmxa files, it seems that some static
values are ignored.
[...]
Why ? Is it a bug ?

No, it's a feature. Modules in .cmxa files that are not referenced in
the program are not linked, as described in the reference manual.
You can turn this behaviour off with the -linkall option, which forces
all modules in .cmxa files to be linked in.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Mar 3, 2005

Comment author: administrator

Intended, documented behaviour.

@vicuna vicuna closed this as completed Mar 3, 2005
@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