moonpool/dev/ocaml/Stdlib/Callback/index.html
2023-08-28 17:11:38 +00:00

2 lines
No EOL
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Callback (ocaml.Stdlib.Callback)</title><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">ocaml</a> &#x00BB; <a href="../index.html">Stdlib</a> &#x00BB; Callback</nav><header class="odoc-preamble"><h1>Module <code><span>Stdlib.Callback</span></code></h1><p>Registering OCaml values with the C runtime.</p><p>This module allows OCaml values to be registered with the C runtime under a symbolic name, so that C code can later call back registered OCaml functions, or raise registered OCaml exceptions.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-register"><a href="#val-register" class="anchor"></a><code><span><span class="keyword">val</span> register : <span>string <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Callback.register n v</code> registers the value <code>v</code> under the name <code>n</code>. C code can later retrieve a handle to <code>v</code> by calling <code>caml_named_value(n)</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-register_exception"><a href="#val-register_exception" class="anchor"></a><code><span><span class="keyword">val</span> register_exception : <span>string <span class="arrow">&#45;&gt;</span></span> <span>exn <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Callback.register_exception n exn</code> registers the exception contained in the exception value <code>exn</code> under the name <code>n</code>. C code can later retrieve a handle to the exception by calling <code>caml_named_value(n)</code>. The exception value thus obtained is suitable for passing as first argument to <code>raise_constant</code> or <code>raise_with_arg</code>.</p></div></div></div></body></html>