From a87b5026d859c37fdc22304c80753a66b890d332 Mon Sep 17 00:00:00 2001 From: Woolfgm <160153877+Dahka2321@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:56:21 +0100 Subject: [PATCH 1/2] Update index.html --- .../pages/api/snarky/Snarky/Libsnark/Print_func/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/website/pages/api/snarky/Snarky/Libsnark/Print_func/index.html b/website/website/pages/api/snarky/Snarky/Libsnark/Print_func/index.html index 5022f0fc96..fb9d2e3328 100644 --- a/website/website/pages/api/snarky/Snarky/Libsnark/Print_func/index.html +++ b/website/website/pages/api/snarky/Snarky/Libsnark/Print_func/index.html @@ -1,2 +1,2 @@ -Print_func (snarky.Snarky.Libsnark.Print_func)

Module Libsnark.Print_func

val print : (string -> string) Core.ref

Internal: The reference to the user-defined function passed to set_printing_fun. OCaml may relocate the function in memory if it is heap-allocated (e.g. using a closure) during its GC cycle, so we store a reference here and call it from the statically-allocated OCaml function dispatch below.

val puts : string -> unit

A reference to the C puts function.

The OCaml stdlib functions use thread-unsafe primitives that may cause a crash if calls from multiple threads overlap, so we use this to avoid their thread-unsafe blocking behaviour.

val dispatch : string -> unit

The dispatcher passed to the C++ interface in set_printing_fun. We cannot pass the user-provided function directly to the C++ side in case of GC relocation, so this provides a statically-allocated wrapper.

The call to puts is made from here instead of the C++ side so that OCaml's GC behaviour is mitigated by the the Ctypes API.

\ No newline at end of file +Print_func (snarky.Snarky.Libsnark.Print_func)

Module Libsnark.Print_func

val print : (string -> string) Core.ref

Internal: The reference to the user-defined function passed to set_printing_fun. OCaml may relocate the function in memory if it is heap-allocated (e.g. using a closure) during its GC cycle, so we store a reference here and call it from the statically-allocated OCaml function dispatch below.

val puts : string -> unit

A reference to the C puts function.

The OCaml stdlib functions use thread-unsafe primitives that may cause a crash if calls from multiple threads overlap, so we use this to avoid their thread-unsafe blocking behaviour.

val dispatch : string -> unit

The dispatcher passed to the C++ interface in set_printing_fun. We cannot pass the user-provided function directly to the C++ side in case of GC relocation, so this provides a statically-allocated wrapper.

The call to puts is made from here instead of the C++ side so that OCaml's GC behaviour is mitigated by the Ctypes API.

From 57af3a064e5ad08d3ec82dab2fde051c17753ee3 Mon Sep 17 00:00:00 2001 From: Woolfgm <160153877+Dahka2321@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:57:27 +0100 Subject: [PATCH 2/2] Update index.html --- .../pages/api/snarky/Snarky__Libsnark/Print_func/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/website/pages/api/snarky/Snarky__Libsnark/Print_func/index.html b/website/website/pages/api/snarky/Snarky__Libsnark/Print_func/index.html index cfd641a281..94354163b2 100644 --- a/website/website/pages/api/snarky/Snarky__Libsnark/Print_func/index.html +++ b/website/website/pages/api/snarky/Snarky__Libsnark/Print_func/index.html @@ -1,2 +1,2 @@ -Print_func (snarky.Snarky__Libsnark.Print_func)

Module Snarky__Libsnark.Print_func

val print : (string -> string) Core.ref

Internal: The reference to the user-defined function passed to set_printing_fun. OCaml may relocate the function in memory if it is heap-allocated (e.g. using a closure) during its GC cycle, so we store a reference here and call it from the statically-allocated OCaml function dispatch below.

val puts : string -> unit

A reference to the C puts function.

The OCaml stdlib functions use thread-unsafe primitives that may cause a crash if calls from multiple threads overlap, so we use this to avoid their thread-unsafe blocking behaviour.

val dispatch : string -> unit

The dispatcher passed to the C++ interface in set_printing_fun. We cannot pass the user-provided function directly to the C++ side in case of GC relocation, so this provides a statically-allocated wrapper.

The call to puts is made from here instead of the C++ side so that OCaml's GC behaviour is mitigated by the the Ctypes API.

\ No newline at end of file +Print_func (snarky.Snarky__Libsnark.Print_func)

Module Snarky__Libsnark.Print_func

val print : (string -> string) Core.ref

Internal: The reference to the user-defined function passed to set_printing_fun. OCaml may relocate the function in memory if it is heap-allocated (e.g. using a closure) during its GC cycle, so we store a reference here and call it from the statically-allocated OCaml function dispatch below.

val puts : string -> unit

A reference to the C puts function.

The OCaml stdlib functions use thread-unsafe primitives that may cause a crash if calls from multiple threads overlap, so we use this to avoid their thread-unsafe blocking behaviour.

val dispatch : string -> unit

The dispatcher passed to the C++ interface in set_printing_fun. We cannot pass the user-provided function directly to the C++ side in case of GC relocation, so this provides a statically-allocated wrapper.

The call to puts is made from here instead of the C++ side so that OCaml's GC behaviour is mitigated by the Ctypes API.