The three main components of JavaCPP are the Builder
, the Loader
, and the Pointer
. The first one takes care of parsing C/C++ header files and building native libraries at compile time, the second gets invoked at runtime to load these libraries, and extract them from JAR files into the cache if necessary, while the third is responsible for providing an API to call native functions and access native variables.
The execution of the Builder
typically consists of 4 stages, either as a standalone command line utility or via a plugin such as BuildMojo
for Maven:
cppbuild.sh
from the JavaCPP Presets,
Parser
on the given InfoMap
and the header files listed in the @Platform
annotation,
Generator
on the Java interfaces,
When executing Loader.load()
at runtime, either manually or as part of the automatically generated static { }
blocks, it does 3 things automatically:
~/.javacpp/cache
,System.load()
, or System.loadLibrary()
if not found on the class path.Users access through subclasses of Pointer
all native arrays, functions, and objects of class
, struct
, or union
types. The following subclasses are provided by default for basic data types:
BytePointer
, ShortPointer
, IntPointer
, LongPointer
, CLongPointer
, SizeTPointer
, FloatPointer
, DoublePointer
, BoolPointer
, CharPointer
, PointerPointer
, FunctionPointer
Pointer
calls all functions, and reads and writes all variables via JNI, which introduces overhead. For this reason, JavaCPP also comes with the indexer
package, mapping native data to multidimensional arrays (aka tensors, including unsigned integer types and half floats) via sun.misc.Unsafe
, to support memory regions larger than 2 GB, falling back on NIO buffers only when not supported such as on Android.
There is also PointerScope
to manage more easily and efficiently the native memory and resources used by a group of Pointer
objects.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4