Getting Started
+Generated by Codox
coffi v1.0.486
Getting Started
Installation
This library is available on Clojars. Add one of the following entries to the :deps key of your deps.edn:
org.suskalo/coffi {:mvn/version "x.y.z"}
@@ -49,7 +49,17 @@ io.github.IGJoshua/coffi {:git/tag "x.y.z" :git/sha "abcdef0"}
This will load libz from the lib subdirectory of the current working directory. As you can see this requires the entire filename, including platform-specific file extensions.
If a library is attempted to be loaded but doesn’t exist or otherwise can’t be loaded, an exception is thrown. This can be convenient as any namespace with a load-library call at the top level cannot be required without the library being able to be loaded.
Primitive Types
-Coffi defines a basic set of primitive types: - byte - short - int - long - char - float - double - pointer
+Coffi defines a basic set of primitive types:
+
+- byte
+- short
+- int
+- long
+- char
+- float
+- double
+- pointer
+
Each of these types maps to their C counterpart. Values of any of these primitive types except for pointer will be cast with their corresponding Clojure function when they are passed as arguments to native functions. Additionally, the c-string type is defined, although it is not primitive.
Composite Types
In addition, some composite types are also defined in coffi, including struct and union types (unions will be discussed with serialization and deserialization). For an example C struct and function:
diff --git a/docs/02-Memory-Management.html b/docs/02-Memory-Management.html
index a0489fa..1ed7324 100644
--- a/docs/02-Memory-Management.html
+++ b/docs/02-Memory-Management.html
@@ -1,6 +1,6 @@
-Memory Management Generated by Codox
coffi v1.0.486
Memory Management
+Memory Management Generated by Codox
coffi v1.0.486
Memory Management
In order to serialize any non-primitive type, off-heap memory needs to be allocated. When memory is allocated inside the JVM, the memory is associated with an arena. If none is provided, the arena is an implicit arena, and the memory will be freed when the serialized object is garbage collected.
In many cases this is not desirable, because the memory is not freed in a deterministic manner, causing garbage collection pauses to become longer, as well as changing allocation performance. Instead of an implicit arena, there are other kinds of arenas as well. A confined-arena is a thread-local arena. Confined arenas are Closeable, which means they should usually be used in a with-open form. When a confined-arena is closed, it immediately frees all the memory associated with it. The previous example, out-int, can be implemented with a confined arena.
(defcfn out-int
diff --git a/docs/03-Builtin-Types.html b/docs/03-Builtin-Types.html
index ca6ec7d..0222e5a 100644
--- a/docs/03-Builtin-Types.html
+++ b/docs/03-Builtin-Types.html
@@ -1,6 +1,6 @@
-Built-in Types Generated by Codox
coffi v1.0.486
Built-in Types
+Built-in Types **WIP** Generated by Codox
coffi v1.0.486
Built-in Types WIP
Primitives
Arrays
Pointers
diff --git a/docs/04-Custom-Types.html b/docs/04-Custom-Types.html
index 50e6805..3194169 100644
--- a/docs/04-Custom-Types.html
+++ b/docs/04-Custom-Types.html
@@ -1,6 +1,6 @@
-Custom Types Generated by Codox
coffi v1.0.486
Custom Types
+Custom Types Generated by Codox
coffi v1.0.486
Custom Types
Custom types with serializers and deserializers may be created. This is done using two sets of three multimethods which can be extended by the user. For any given type, only one set need be implemented.
Two examples of custom types are given here, one is a 3d vector, and the other an example of a tagged union.
Vector3
diff --git a/docs/05-Low-Level-Wrappers.html b/docs/05-Low-Level-Wrappers.html
index 0b9ab2c..6539b51 100644
--- a/docs/05-Low-Level-Wrappers.html
+++ b/docs/05-Low-Level-Wrappers.html
@@ -1,6 +1,6 @@
-Low-Level Wrappers Generated by Codox
coffi v1.0.486
Low-Level Wrappers
+Low-Level Wrappers Generated by Codox
coffi v1.0.486
Low-Level Wrappers
Unwrapped Native Handles
Some native libraries work with handles to large amounts of data at once, making it undesirable to marshal data back and forth from Clojure, both because it’s not necessary to work with the data in Clojure directly, or also because of the high (de)serialization costs associated with marshaling. In cases like these, unwrapped native handles are desirable.
The functions make-downcall and make-varargs-factory are also provided to create raw function handles.
diff --git a/docs/50-Data-Model.html b/docs/50-Data-Model.html
index aba841f..79468a1 100644
--- a/docs/50-Data-Model.html
+++ b/docs/50-Data-Model.html
@@ -1,6 +1,6 @@
-Data Model Generated by Codox
coffi v1.0.486
Data Model
+Data Model Generated by Codox
coffi v1.0.486
Data Model
In addition to the macros and functions provided to build a Clojure API for native libraries, facilities are provided for taking data and loading all the symbols specified by it. This can be useful if a library provides (or an external provider maintains) a data representation of their API, as Clojure data to represent it may be programmatically generated from these sources.
The data to represent an API is a map with the following form:
(def strlen-libspec
diff --git a/docs/99-Benchmarks.html b/docs/99-Benchmarks.html
index 0009067..94fd620 100644
--- a/docs/99-Benchmarks.html
+++ b/docs/99-Benchmarks.html
@@ -1,6 +1,6 @@
-Benchmarks Generated by Codox
coffi v1.0.486
Benchmarks
+Benchmarks **OUTDATED** Generated by Codox
coffi v1.0.486
Benchmarks OUTDATED
BENCHMARKS FOR COFFI AND DTYPE-NEXT ARE BASED ON AN OLD VERSION. NEW BENCHMARKS WILL BE CREATED SOON.
An additional consideration when thinking about alternatives is the performance of each available option. It’s an established fact that JNA (used by all three alternative libraries on JDK <16) introduces more overhead when calling native code than JNI does.
In order to provide a benchmark to see how much of a difference the different native interfaces make, we can use criterium to benchmark each. GLFW’s glfwGetTime function will be used for the test as it performs a simple operation, and is conveniently already wrapped in JNI by the excellent LWJGL library.
diff --git a/docs/articles/01-Getting-Started.md b/docs/articles/01-Getting-Started.md
index 6fb3cc6..1374b52 100644
--- a/docs/articles/01-Getting-Started.md
+++ b/docs/articles/01-Getting-Started.md
@@ -109,6 +109,7 @@ being able to be loaded.
### Primitive Types
Coffi defines a basic set of primitive types:
+
- byte
- short
- int
diff --git a/docs/articles/03-Builtin-Types.md b/docs/articles/03-Builtin-Types.md
index 81d8cfb..03bb8c8 100644
--- a/docs/articles/03-Builtin-Types.md
+++ b/docs/articles/03-Builtin-Types.md
@@ -1,4 +1,4 @@
-# Built-in Types
+# Built-in Types **WIP**
### Primitives
diff --git a/docs/articles/99-Benchmarks.md b/docs/articles/99-Benchmarks.md
index 69ef11c..6e30eff 100644
--- a/docs/articles/99-Benchmarks.md
+++ b/docs/articles/99-Benchmarks.md
@@ -1,4 +1,4 @@
-# Benchmarks
+# Benchmarks **OUTDATED**
**BENCHMARKS FOR COFFI AND DTYPE-NEXT ARE BASED ON AN OLD VERSION. NEW BENCHMARKS WILL BE CREATED SOON.**
An additional consideration when thinking about alternatives is the performance
diff --git a/docs/coffi.ffi.html b/docs/coffi.ffi.html
index c911409..975a489 100644
--- a/docs/coffi.ffi.html
+++ b/docs/coffi.ffi.html
@@ -1,41 +1,41 @@
-coffi.ffi documentation Generated by Codox
coffi v1.0.486
coffi.ffi
Functions for creating handles to native functions and loading native libraries.
+coffi.ffi documentation Generated by Codox
coffi v1.0.486
coffi.ffi
Functions for creating handles to native functions and loading native libraries.
cfn
(cfn symbol args ret)Constructs a Clojure function to call the native function referenced by symbol.
The function returned will serialize any passed arguments into the args types, and deserialize the return to the ret type.
If your args and ret are constants, then it is more efficient to call make-downcall followed by make-serde-wrapper because the latter has an inline definition which will result in less overhead from serdes.
-defcfn
macro
(defcfn name docstring? attr-map? symbol arg-types ret-type)(defcfn name docstring? attr-map? symbol arg-types ret-type native-fn & fn-tail)Defines a Clojure function which maps to a native function.
+defcfn
macro
(defcfn name docstring? attr-map? symbol arg-types ret-type)(defcfn name docstring? attr-map? symbol arg-types ret-type native-fn & fn-tail)Defines a Clojure function which maps to a native function.
name is the symbol naming the resulting var. symbol is a symbol or string naming the library symbol to link against. arg-types is a vector of qualified keywords representing the argument types. ret-type is a single qualified keyword representing the return type. fn-tail is the body of the function (potentially with multiple arities) which wraps the native one. Inside the function, native-fn is bound to a function that will serialize its arguments, call the native function, and deserialize its return type. If any body is present, you must call this function in order to call the native code.
If no fn-tail is provided, then the resulting function will simply serialize the arguments according to arg-types, call the native function, and deserialize the return value.
The number of args in the fn-tail need not match the number of arg-types for the native function. It need only call the native wrapper function with the correct arguments.
See serialize, deserialize, make-downcall.
-defconst
macro
(defconst symbol docstring? symbol-or-addr type)Defines a var named by symbol to be the value of the given type from symbol-or-addr.
-defvar
macro
(defvar symbol docstring? symbol-or-addr type)Defines a var named by symbol to be a reference to the native memory from symbol-or-addr.
-ensure-symbol
(ensure-symbol symbol-or-addr)Returns the argument if it is a MemorySegment, otherwise calls find-symbol on it.
-freset!
(freset! static-var newval)Sets the value of static-var to newval, running it through serialize.
-fswap!
(fswap! static-var f & args)Non-atomically runs the function f over the value stored in static-var.
+defconst
macro
(defconst symbol docstring? symbol-or-addr type)Defines a var named by symbol to be the value of the given type from symbol-or-addr.
+defvar
macro
(defvar symbol docstring? symbol-or-addr type)Defines a var named by symbol to be a reference to the native memory from symbol-or-addr.
+ensure-symbol
(ensure-symbol symbol-or-addr)Returns the argument if it is a MemorySegment, otherwise calls find-symbol on it.
+freset!
(freset! static-var newval)Sets the value of static-var to newval, running it through serialize.
+fswap!
(fswap! static-var f & args)Non-atomically runs the function f over the value stored in static-var.
The value is deserialized before passing it to f, and serialized before putting the value into static-var.
-load-system-library
(load-system-library libname)Loads the library named libname from the system’s load path.
-make-downcall
(make-downcall symbol-or-addr args ret)Constructs a downcall function reference to symbol-or-addr with the given args and ret types.
+load-system-library
(load-system-library libname)Loads the library named libname from the system’s load path.
+make-downcall
(make-downcall symbol-or-addr args ret)Constructs a downcall function reference to symbol-or-addr with the given args and ret types.
The function returned takes only arguments whose types match exactly the java-layout for that type, and returns an argument with exactly the java-layout of the ret type. This function will perform no serialization or deserialization of arguments or the return type.
If the ret type is non-primitive, then the returned function will take a first argument of a SegmentAllocator.
-make-serde-varargs-wrapper
(make-serde-varargs-wrapper varargs-factory required-args ret-type)Constructs a wrapper function for the varargs-factory which produces functions that serialize the arguments and deserialize the return value.
-make-serde-wrapper
(make-serde-wrapper downcall arg-types ret-type)Constructs a wrapper function for the downcall which serializes the arguments and deserializes the return value.
-make-varargs-factory
(make-varargs-factory symbol required-args ret)Returns a function for constructing downcalls with additional types for arguments.
+make-serde-varargs-wrapper
(make-serde-varargs-wrapper varargs-factory required-args ret-type)Constructs a wrapper function for the varargs-factory which produces functions that serialize the arguments and deserialize the return value.
+make-serde-wrapper
(make-serde-wrapper downcall arg-types ret-type)Constructs a wrapper function for the downcall which serializes the arguments and deserializes the return value.
+make-varargs-factory
(make-varargs-factory symbol required-args ret)Returns a function for constructing downcalls with additional types for arguments.
The required-args are the types of the first arguments passed to the downcall handle, and the values passed to the returned function are only the varargs types.
The returned function is memoized, so that only one downcall function will be generated per combination of argument types.
See make-downcall.
-reify-libspec
(reify-libspec libspec)Loads all the symbols specified in the libspec.
The value of each key of the passed map is transformed as by reify-symbolspec.
-reify-symbolspec
multimethod
Takes a spec for a symbol reference and returns a live value for that type.
-static-variable
(static-variable symbol-or-addr type)Constructs a reference to a mutable value stored in symbol-or-addr.
+reify-symbolspec
multimethod
Takes a spec for a symbol reference and returns a live value for that type.
+static-variable
(static-variable symbol-or-addr type)static-variable-segment
(static-variable-segment static-var)Gets the backing MemorySegment from static-var.
+static-variable-segment
(static-variable-segment static-var)Gets the backing MemorySegment from static-var.
This is primarily useful when you need to pass the static variable’s address to a native function which takes an Addressable.
-vacfn-factory
(vacfn-factory symbol required-args ret)Constructs a varargs factory to call the native function referenced by symbol.
+vacfn-factory
(vacfn-factory symbol required-args ret)Constructs a varargs factory to call the native function referenced by symbol.
The function returned takes any number of type arguments and returns a specialized Clojure function for calling the native function with those arguments.
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/coffi.layout.html b/docs/coffi.layout.html
index 0783ab7..aaca13e 100644
--- a/docs/coffi.layout.html
+++ b/docs/coffi.layout.html
@@ -1,6 +1,6 @@
-coffi.layout documentation Generated by Codox
coffi v1.0.486
coffi.layout
Functions for adjusting the layout of structs.
+coffi.layout documentation Generated by Codox
coffi v1.0.486
coffi.layout
Functions for adjusting the layout of structs.
with-c-layout
(with-c-layout struct-spec)Forces a struct specification to C layout rules.
This will add padding fields between fields to match C alignment requirements.
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/coffi.mem.html b/docs/coffi.mem.html
index 0afc416..b8f16b4 100644
--- a/docs/coffi.mem.html
+++ b/docs/coffi.mem.html
@@ -1,121 +1,121 @@
-coffi.mem documentation Generated by Codox
coffi v1.0.486
coffi.mem
Functions for managing native allocations, memory arenas, and (de)serialization.
+coffi.mem documentation Generated by Codox
coffi v1.0.486
coffi.mem
Functions for managing native allocations, memory arenas, and (de)serialization.
For any new type to be implemented, three multimethods must be overriden, but which three depends on the native representation of the type.
If the native representation of the type is a primitive (whether or not other data beyond the primitive is associated with it, as e.g. a pointer), then primitive-type must be overriden to return which primitive type it is serialized as, then serialize* and deserialize* should be overriden.
If the native representation of the type is a composite type, like a union, struct, or array, then c-layout must be overriden to return the native layout of the type, and serialize-into and deserialize-from should be overriden to allow marshaling values of the type into and out of memory segments.
address?
(address? addr)Checks if an object is a memory address.
nil is considered an address.
-alloc
(alloc size)(alloc size arena)(alloc size alignment arena)Allocates size bytes.
If an arena is provided, the allocation will be reclaimed when it is closed.
-alloc-instance
(alloc-instance type)(alloc-instance type arena)Allocates a memory segment for the given type.
-alloc-with
(alloc-with allocator size)(alloc-with allocator size alignment)Allocates size bytes using the allocator.
-alloc-instance
(alloc-instance type)(alloc-instance type arena)Allocates a memory segment for the given type.
+alloc-with
(alloc-with allocator size)(alloc-with allocator size alignment)Allocates size bytes using the allocator.
+arena-allocator
(arena-allocator arena)Constructs a SegmentAllocator from the given Arena.
This is primarily used when working with unwrapped downcall functions. When a downcall function returns a non-primitive type, it must be provided with an allocator.
-as-segment
(as-segment address)(as-segment address size)(as-segment address size arena)(as-segment address size arena cleanup)Dereferences an address into a memory segment associated with the arena (default global).
-auto-arena
(auto-arena)Constructs a new memory arena that is managed by the garbage collector.
+as-segment
(as-segment address)(as-segment address size)(as-segment address size arena)(as-segment address size arena cleanup)Dereferences an address into a memory segment associated with the arena (default global).
+auto-arena
(auto-arena)Constructs a new memory arena that is managed by the garbage collector.
The arena may be shared across threads, and all resources created with it will be cleaned up at the same time, when all references have been collected.
This type of arena cannot be closed, and therefore should not be created in a with-open clause.
-c-layout
multimethod
Gets the layout object for a given type.
If a type is primitive it will return the appropriate primitive layout (see c-prim-layout).
Otherwise, it should return a GroupLayout for the given type.
-clone-segment
(clone-segment segment)(clone-segment segment arena)Clones the content of segment into a new segment of the same size.
-clone-segment
(clone-segment segment)(clone-segment segment arena)Clones the content of segment into a new segment of the same size.
+confined-arena
(confined-arena)Constructs a new arena for use only in this thread.
The memory allocated within this arena is cheap to allocate, like a native stack.
The memory allocated within this arena will be cleared once it is closed, so it is usually a good idea to create it in a with-open clause.
-defalias
macro
(defalias new-type aliased-type)Defines a type alias from new-type to aliased-type.
+defalias
macro
(defalias new-type aliased-type)Defines a type alias from new-type to aliased-type.
This creates needed serialization and deserialization implementations for the aliased type.
-deserialize
(deserialize obj type)Deserializes an arbitrary type.
For types which have a primitive representation, this deserializes the primitive representation. For types which do not, this deserializes out of a segment.
-deserialize*
multimethod
Deserializes a primitive object into a Clojure data structure.
This is intended for use with types that are returned as a primitive but which need additional processing before they can be returned.
-deserialize-from
multimethod
Deserializes the given segment into a Clojure data structure.
+deserialize-from
multimethod
Deserializes the given segment into a Clojure data structure.
For types that serialize to primitives, a default implementation will deserialize the primitive before calling deserialize*.
-global-arena
(global-arena)Constructs the global arena, which will never reclaim its resources.
+global-arena
(global-arena)Constructs the global arena, which will never reclaim its resources.
This arena may be shared across threads, but is intended mainly in cases where memory is allocated with alloc but is either never freed or whose management is relinquished to a native library, such as when returned from a callback.
-java-layout
(java-layout type)Gets the Java class to an argument of this type for a method handle.
+java-layout
(java-layout type)Gets the Java class to an argument of this type for a method handle.
If a type serializes to a primitive it returns return a Java primitive type. Otherwise, it returns MemorySegment.
-native-endian
The ByteOrder for the native endianness of the current hardware.
See big-endian, little-endian.
-null
The NULL pointer object.
While this object is safe to pass to functions which serialize to a pointer, it’s generally encouraged to simply pass nil. This value primarily exists to make it easier to write custom types with a primitive pointer representation.
-primitive-type
multimethod
Gets the primitive type that is used to pass as an argument for the type.
+primitive-type
multimethod
Gets the primitive type that is used to pass as an argument for the type.
This is for objects which are passed to native functions as primitive types, but which need additional logic to be performed during serialization and deserialization.
Implementations of this method should take into account that type arguments may not always be evaluated before passing to this function.
Returns nil for any type which does not have a primitive representation.
-read-address
(read-address segment)(read-address segment offset)Reads an address from the segment, at an optional offset, wrapped in a MemorySegment.
-read-byte
(read-byte segment)(read-byte segment offset)Reads a byte from the segment, at an optional offset.
-read-char
(read-char segment)(read-char segment offset)Reads a char from the segment, at an optional offset.
-read-double
(read-double segment)(read-double segment offset)(read-double segment offset byte-order)Reads a double from the segment, at an optional offset.
+read-address
(read-address segment)(read-address segment offset)Reads an address from the segment, at an optional offset, wrapped in a MemorySegment.
+read-byte
(read-byte segment)(read-byte segment offset)Reads a byte from the segment, at an optional offset.
+read-char
(read-char segment)(read-char segment offset)Reads a char from the segment, at an optional offset.
+read-double
(read-double segment)(read-double segment offset)(read-double segment offset byte-order)Reads a double from the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-read-float
(read-float segment)(read-float segment offset)(read-float segment offset byte-order)Reads a float from the segment, at an optional offset.
+read-float
(read-float segment)(read-float segment offset)(read-float segment offset byte-order)Reads a float from the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-read-int
(read-int segment)(read-int segment offset)(read-int segment offset byte-order)Reads a int from the segment, at an optional offset.
+read-int
(read-int segment)(read-int segment offset)(read-int segment offset byte-order)Reads a int from the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-read-long
(read-long segment)(read-long segment offset)(read-long segment offset byte-order)Reads a long from the segment, at an optional offset.
+read-long
(read-long segment)(read-long segment offset)(read-long segment offset byte-order)Reads a long from the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-read-short
(read-short segment)(read-short segment offset)(read-short segment offset byte-order)Reads a short from the segment, at an optional offset.
+read-short
(read-short segment)(read-short segment offset)(read-short segment offset byte-order)Reads a short from the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-reinterpret
(reinterpret segment size)(reinterpret segment size arena)(reinterpret segment size arena cleanup)Reinterprets the segment as having the passed size.
+reinterpret
(reinterpret segment size)(reinterpret segment size arena)(reinterpret segment size arena cleanup)Reinterprets the segment as having the passed size.
If arena is passed, the scope of the segment is associated with the arena, as well as its access constraints. If cleanup is passed, it will be a 1-argument function of a fresh memory segment backed by the same memory as the returned segment which should perform any required cleanup operations. It will be called when the arena is closed.
-seq-of
(seq-of type segment)Constructs a lazy sequence of type elements deserialized from segment.
-seq-of
(seq-of type segment)Constructs a lazy sequence of type elements deserialized from segment.
+serialize
(serialize obj type)(serialize obj type arena)Serializes an arbitrary type.
For types which have a primitive representation, this serializes into that representation. For types which do not, it allocates a new segment and serializes into that.
-serialize*
multimethod
Constructs a serialized version of the obj and returns it.
Any new allocations made during the serialization should be tied to the given arena, except in extenuating circumstances.
This method should only be implemented for types that serialize to primitives.
-serialize-into
multimethod
Writes a serialized version of the obj to the given segment.
Any new allocations made during the serialization should be tied to the given arena, except in extenuating circumstances.
This method should be implemented for any type which does not override c-layout.
For any other type, this will serialize it as serialize* before writing the result value into the segment.
-slice
(slice segment offset)(slice segment offset size)Get a slice over the segment with the given offset.
-slice-segments
(slice-segments segment size)Constructs a lazy seq of size-length memory segments, sliced from segment.
-write-address
(write-address segment value)(write-address segment offset value)Writes the address of the MemorySegment value to the segment, at an optional offset.
-write-byte
(write-byte segment value)(write-byte segment offset value)Writes a byte to the segment, at an optional offset.
-write-char
(write-char segment value)(write-char segment offset value)Writes a char to the segment, at an optional offset.
-write-double
(write-double segment value)(write-double segment offset value)(write-double segment offset byte-order value)Writes a double to the segment, at an optional offset.
+slice
(slice segment offset)(slice segment offset size)Get a slice over the segment with the given offset.
+slice-segments
(slice-segments segment size)Constructs a lazy seq of size-length memory segments, sliced from segment.
+write-address
(write-address segment value)(write-address segment offset value)Writes the address of the MemorySegment value to the segment, at an optional offset.
+write-byte
(write-byte segment value)(write-byte segment offset value)Writes a byte to the segment, at an optional offset.
+write-char
(write-char segment value)(write-char segment offset value)Writes a char to the segment, at an optional offset.
+write-double
(write-double segment value)(write-double segment offset value)(write-double segment offset byte-order value)Writes a double to the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-write-float
(write-float segment value)(write-float segment offset value)(write-float segment offset byte-order value)Writes a float to the segment, at an optional offset.
+write-float
(write-float segment value)(write-float segment offset value)(write-float segment offset byte-order value)Writes a float to the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-write-int
(write-int segment value)(write-int segment offset value)(write-int segment offset byte-order value)Writes a int to the segment, at an optional offset.
+write-int
(write-int segment value)(write-int segment offset value)(write-int segment offset byte-order value)Writes a int to the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-write-long
(write-long segment value)(write-long segment offset value)(write-long segment offset byte-order value)Writes a long to the segment, at an optional offset.
+write-long
(write-long segment value)(write-long segment offset value)(write-long segment offset byte-order value)Writes a long to the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-write-short
(write-short segment value)(write-short segment offset value)(write-short segment offset byte-order value)Writes a short to the segment, at an optional offset.
+write-short
(write-short segment value)(write-short segment offset value)(write-short segment offset byte-order value)Writes a short to the segment, at an optional offset.
If byte-order is not provided, it defaults to native-endian.
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index 0009880..a753207 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,6 +1,6 @@
-coffi v1.0.486 Generated by Codox
coffi v1.0.486
coffi v1.0.486
A Foreign Function Interface in Clojure for JDK 22+.
Topics
Namespaces
coffi.ffi
Functions for creating handles to native functions and loading native libraries.
+coffi v1.0.486 Generated by Codox
coffi v1.0.486
coffi v1.0.486
A Foreign Function Interface in Clojure for JDK 22+.
Topics
- Getting Started
- Memory Management
- Built-in Types **WIP**
- Custom Types
- Low-Level Wrappers
- Data Model
- Benchmarks **OUTDATED**
Namespaces
coffi.ffi
Functions for creating handles to native functions and loading native libraries.
Public variables and functions:
coffi.mem
Functions for managing native allocations, memory arenas, and (de)serialization.
Public variables and functions:
- address-of
- address?
- align-of
- alloc
- alloc-instance
- alloc-with
- arena-allocator
- as-segment
- auto-arena
- big-endian
- byte-layout
- c-layout
- char-layout
- clone-segment
- confined-arena
- copy-segment
- defalias
- deserialize
- deserialize*
- deserialize-from
- double-alignment
- double-layout
- double-size
- float-alignment
- float-layout
- float-size
- global-arena
- int-alignment
- int-layout
- int-size
- java-layout
- java-prim-layout
- little-endian
- long-alignment
- long-layout
- long-size
- native-endian
- null
- null?
- pointer-alignment
- pointer-layout
- pointer-size
- primitive-type
- primitive-types
- primitive?
- read-address
- read-byte
- read-char
- read-double
- read-float
- read-int
- read-long
- read-short
- reinterpret
- seq-of
- serialize
- serialize*
- serialize-into
- shared-arena
- short-alignment
- short-layout
- short-size
- size-of
- slice
- slice-segments
- write-address
- write-byte
- write-char
- write-double
- write-float
- write-int
- write-long
- write-short
\ No newline at end of file