HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

ocamlfind — The findlib package manager for OCaml. Simplifies linking executables with external libraries. More

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thefindlibcommandocamlfindclipackageformanager

Problem

How to use the ocamlfind command: The findlib package manager for OCaml. Simplifies linking executables with external libraries. More information: <https://manned.org/ocamlfind>.

Solution

ocamlfind — The findlib package manager for OCaml. Simplifies linking executables with external libraries. More information: <https://manned.org/ocamlfind>.

Compile a source file to a native binary and link with packages:
ocamlfind ocamlopt -package {{package1,package2,...}} -linkpkg -o {{path/to/executable}} {{path/to/source.ml}}


Compile a source file to a bytecode binary and link with packages:
ocamlfind ocamlc -package {{package1,package2,...}} -linkpkg -o {{path/to/executable}} {{path/to/source.ml}}


Cross-compile for a different platform:
ocamlfind -toolchain {{cross-toolchain}} ocamlopt -o {{path/to/executable}} {{path/to/source.ml}}

Code Snippets

Compile a source file to a native binary and link with packages

ocamlfind ocamlopt -package {{package1,package2,...}} -linkpkg -o {{path/to/executable}} {{path/to/source.ml}}

Compile a source file to a bytecode binary and link with packages

ocamlfind ocamlc -package {{package1,package2,...}} -linkpkg -o {{path/to/executable}} {{path/to/source.ml}}

Cross-compile for a different platform

ocamlfind -toolchain {{cross-toolchain}} ocamlopt -o {{path/to/executable}} {{path/to/source.ml}}

Context

tldr-pages: common/ocamlfind

Revisions (0)

No revisions yet.