File: libdynlink.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (41 lines) | stat: -rw-r--r-- 2,605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="hevea 2.32">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="manual.css">
<title>Chapter 33  The dynlink library: dynamic loading and linking of object files</title>
</head>
<body>
<a href="libgraph.html"><img src="previous_motif.svg" alt="Previous"></a>
<a href="index.html"><img src="contents_motif.svg" alt="Up"></a>
<a href="libbigarray.html"><img src="next_motif.svg" alt="Next"></a>
<hr>
<h1 class="chapter" id="sec586">Chapter 33  The dynlink library: dynamic loading and linking of object files</h1>
<p>The <span class="c003">dynlink</span> library supports type-safe dynamic loading and linking
of bytecode object files (<span class="c003">.cmo</span> and <span class="c003">.cma</span> files) in a running
bytecode program, or of native plugins (usually <span class="c003">.cmxs</span> files) in a
running native program. Type safety is ensured by limiting the set of
modules from the running program that the loaded object file can
access, and checking that the running program and the loaded object
file have been compiled against the same interfaces for these modules.
In native code, there are also some compatibility checks on the
implementations (to avoid errors with cross-module optimizations); it
might be useful to hide <span class="c003">.cmx</span> files when building native plugins so
that they remain independent of the implementation of modules in the
main program.</p><p>Programs that use the <span class="c003">dynlink</span> library simply need to link
<span class="c003">dynlink.cma</span> or <span class="c003">dynlink.cmxa</span> with their object files and other libraries.</p><p><span class="c013">Note:</span> in order to insure that the dynamically-loaded modules have
access to all the libraries that are visible to the main program (and not just
to the parts of those libraries that are actually used in the main program),
programs using the <span class="c003">dynlink</span> library should be linked with <span class="c003">-linkall</span>.</p><ul class="ftoc2"><li class="li-links">
<a href="libref/Dynlink.html">Module <span class="c003">Dynlink</span>: dynamic loading of bytecode object files</a>
</li></ul>
<hr>
<a href="libgraph.html"><img src="previous_motif.svg" alt="Previous"></a>
<a href="index.html"><img src="contents_motif.svg" alt="Up"></a>
<a href="libbigarray.html"><img src="next_motif.svg" alt="Next"></a>
</body>
</html>