- Change default value for
Pointer.maxPhysicalBytes
toPointer.maxBytes + Runtime.maxMemory()
(pull #310) - Add
Loader.getVersion()
andcheckVersion()
to get versions of Maven artifacts and check against JavaCPP - Fix compile errors caused by
Generator
occurring with callback functions returning a value by reference - Make
Builder
expand entries from the user class path with*
as basename to all JAR files in the directory - Prevent
Loader
from creating symbolic links pointing to themselves by comparing withPath.normalize()
(pull #307) - Fix
Loader.cacheResource()
with the "jrt" protocol as used by jlink (pull #305) - Fix compiler error with
SharedPtrAdapter
andUniquePtrAdapter
in callback functions (pull #304) - Start
Pointer.DeallocatorThread
withsetContextClassLoader(null)
as required by containers (issue deeplearning4j/deeplearning4j#7737) - Add
-print
command line option to access platform properties externally, for example, inside build scripts - Add to
InfoMap
default pointer and value types forssize_t
,char16_t
,char32_t
,std::u16string
, andstd::u32string
- Support multiple instances of
FunctionPointer
subclasses, up to the value in@Allocator(max=...)
(issue bytedeco/javacpp-presets#683) - Allow suffixing library names with
:
to specify exact relative paths to libraries, ignoring any additional prefix or suffix - Prevent
Loader.load()
from trying to load library files that do not exist or to create symbolic links to them - Let
Loader.load()
extract libraries suffixed with##
, but still ignored for copying byBuilder
- Make sure
Loader.load()
also initializes classes that are passed explicitly - Fix
Loader.createLibraryLink()
incorrectly truncating library versions when there is one before and another after the suffix - Iterate extensions of libraries or executables on
Loader.load()
in reverse to be consistent with properties overriding - Allow prefixing library names with
:
to haveLoader
consider them as filenames with prefix and suffix already included - Add
Loader.loadGlobal()
to load symbols globally as often required by Python libraries (issue ContinuumIO/anaconda-issues#6401)
- Have
Parser
outputsetter
as dummy parameter name for setter methods to clarify usage - Add
Indexer.strides(long... sizes)
and use as default strides when not specified by the user - Add
long...
constructors, getters, and setters toCLongPointer
andSizeTPointer
for convenience - Fix some
Generator
issues withFunctionPointer
passed or returned@ByPtrPtr
- Use ModiTect to compile
module-info.java
with JDK 8 and preserve backward compatibility - Add
platform.executable
andplatform.executablepath
properties to bundle executables and extract them withLoader.load()
- Create symbolic links for all libraries preloaded by
Loader
as they get loaded to satisfy libraries like MKL - Prevent
ClassCastException
inLoader
on illegal system properties (issue #289) - Fix
Parser
not replacing all type names of the base class withInfo.flatten
(issue #288) - Let
BuildMojo
return to the Maven project the detected host platform as${javacpp.platform.host}
- Have
BuildMojo
output a JPMS friendly name for the platform and extension back to the Maven project as${javacpp.platform.module}
- Add
Builder.clean
option to delete theoutputDirectory
before generating files - Let
Parser
pick upInfo
explicitly for all constructors by considering their names as functions (issue #284) - Fix
Parser
not always generating files using the simple names of classes - Add a
BuildMojo.targetDirectories
parameter to allow setting multiple directories where to find generated Java files - Add
Parser
support for attributes appearing afterstruct
declarations (issue bytedeco/javacpp-presets#685) - Fix
Parser
overlookingInfo
for constructors inside namespaces or templates (issue #284) - Fix
Parser
applying someInfo.annotations
at the wrong place (issue #284) - Make
Parser
behave the same with@Properties
having only one out ofglobal
ortarget
value set - Enhance
UniquePtrAdapter
with the ability to move pointers out with the&&
operator - Let
Parser
map constructors also for abstract classes withInfo.virtualize
- Fix
Parser
taking theglobal
package as thetarget
package even when both are set - Consider
@Properties(global=..., helper=...)
class names without "." as relative totarget
(pull bytedeco/javacpp-presets#669) - Use regex in
Parser
to translate more Doxygen commands into Javadoc tags (pull #278 and pull #281) - Do not let
Parser
mapoperator=()
when prefixing container name withconst
(pull #280)
- Allow users to override platform properties via system properties starting with "org.bytedeco.javacpp.platform."
- Have
BuildMojo
output its class path back to the Maven project as${javacpp.platform.artifacts}
- Fix potential
NullPointerException
inLoader.findResources()
under the bootstrap class loader - Add
size()
andstride()
methods toIndexer
for convenience - Let
Parser
skip over C++11 style{ ... }
member initializer lists (pull bytedeco/javacpp-presets#642) - Fix
Parser
not picking upInfo
for castoperator
declarations withconst
,&
, or*
(issue bytedeco/javacpp-presets#377) - Add validation for
Builder.environmentVariables
to preventNullPointerException
inexecuteCommand()
- Update
android-arm-clang.properties
andandroid-x86-clang.properties
to API level 21 (Android 5.0) for consistency and forward compatibility - Replace calls to
Class.getResource()
withLoader.findResource()
to work around issues with JPMS (pull #276) - Enhance
Loader.findResources()
withClass.getResource()
and search among parent packages - Take longest common package name among all user classes for the default output path of
Builder
- Add
Bfloat16Indexer
to accessshort
arrays asbfloat16
floating point numbers - When
Indexer.sizes.length != 3
, return -1 forrows()
,cols()
,width()
,height()
, andchannels()
(pull #275) - Synchronize
Loader.cacheResources()
onRuntime
to avoidOverlappingFileLockException
with multiple class loaders (issue bytedeco/javacpp-presets#650) - Annotate
BuildMojo
asthreadSafe
- Fix
Generator
errors for@StdString
and other@Adapter
on@Virtual
return values - Use simple name from
@Properties(target=..., global=...)
class as default for@Platform(library=...)
name - Make sure
Generator
does not useposition
of@Opaque Pointer
output parameters with@Adapter
(pull bytedeco/javacpp-presets#642) - Prevent
Builder
from trying to usePointer
as library name for the output - Add
Builder.generate
option and correspondingParseMojo
to prioritize parsing header files - Fix
Parser
mapping ofconst
function pointer variable declarations - Enhance
Loader.cacheResource()
with support for HTTP connections - Add
module-info.java
and create a multi-release JAR to comply with JPMS (pull #252) - Prevent
Parser
from outputting twice the sameInfo.javaText
by using it as declaration signature - Provide default
Info
forstd::string*
andstd::wstring*
mapping toBytePointer
, andCharPointer
andIntPointer
- Ensure
Parser
skips over attributes of friend declarations or function definitions that are not used - Do not let
Parser
output@Override
when overloading a method with less parameters using default arguments - Allow
Builder
to executejavac
andjava
for convenience, and remove "." from class path (issue #192) - Enhance support for
java.nio.Buffer
by taking into accountoffset
,position
,limit
, andcapacity
on function calls - Make sure
Parser
always uses the short version of identifiers for Java class declarations - Prevent
Parser
from inheriting constructors withusing
when not accessible or of incomplete template instances - Add default
Info
to mapnoexcept
attribute from C++11 to@NoException
annotation - Fix
Parser
failures on variadic function template arguments...
and destructor attributes (pull bytedeco/javacpp-presets#622) - Add
@Properties(global=...)
value to allowParser
to target Java packages (pull #252) - Fix
Generator
output for@Const
parameters of function pointers
- Add support for
linux-mips64el
withlinux-mips64el.properties
(pull #268) - Enhance
Generator
with@ByPtr
for primitive types and@NoException
forFunctionPointer
methods - Add
BooleanPointer
andBooleanIndexer
to access arrays of boolean values withsizeof(jboolean) == 1
- Let
Parser
skip overstatic_assert()
declarations of C++11 - Fix
android-arm-clang.properties
andandroid-x86-clang.properties
for builds with NDK r18 (pull #263) - Add to default
InfoMap
missingint
value type andIntPointer
pointer type forwchar_t
- Add
Loader.getLoadedLibraries()
method for debugging purposes and fix flakyBuilderTest
(issue #245) - Call
PointerScope.attach()
as part ofPointer.deallocator()
, instead ofinit()
, to support custom deallocators as well - Fix
Parser
failing when a value of anstd::pair
basic container is also anstd::pair
(issue bytedeco/javacpp-presets#614) - Fix build issues with
android-arm
and recent versions of the NDK (pull #256) - Add
platform.preloadresource
property to be able to preload libraries from other Java packages - Make
Builder
accept multiple options forplatform.link.prefix
andplatform.link.suffix
(pull #250) - Let
Loader
rename JNI libraries when "already loaded in another classloader" (issue deeplearning4j/deeplearning4j#6166) - Add new
@CriticalRegion
annotation to allow zero-copy access to data of Java arrays (pull #254) - Allow
Builder
to create links for resource libraries even when no Java classes are built - Fix
Loader.cacheResource()
creating a subdirectory named "null" when caching a top-level file - Update
README.md
with references to newly published Basic Architecture of JavaCPP and Mapping Recipes for C/C++ Libraries - Prevent
Parser
from appending annotations to setter methods of variables and for basic containers to satisfy theGenerator
- Have
Parser
wrap theinsert()
anderase()
methods of basic containers to allow modifying lists and sets - Let
Parser
create mutable instances of map containers withoutconst
prefix (issue bytedeco/javacpp-presets#595) - Fix
Parser
sometimes ignoringdefine
ofconst
containers (pull bytedeco/javacpp-presets#547) - Explain the purpose of the
intern()
methods generated for Java enums - Clarify that
Loader.load()
can throwUnsatisfiedLinkError
when interrupted - Synchronize
Loader.loadLibrary()
to fix potential race condition (pull #246)
- Add
Loader.getJavaVM()
method to get the JNIJavaVM
object as required to initialize some libraries - Fix
Parser
from outputting accessors not available withstd::forward_list
orstd::list
- Use
pthread_setspecific()
inGenerator
to detach automatically native threads on exit for Android (pull #243) - Fix issues with anonymous classes by calling
getEnclosingClass()
instead ofgetDeclaringClass()
- Add
android-arm-clang.properties
,android-arm64-clang.properties
,android-x86-clang.properties
andandroid-x86_64-clang.properties
- Search in
linkpath
beforepreloadpath
to avoid copying or loading unwanted libraries - Fix
Builder
not bundling libraries containing a#
fragment only useful at load time - Make
Parser
take into account implicit constructors even when inheriting some withusing
declarations - Pick up
Parser
translation of enum and macro expressions fromInfo.javaNames
- Let
Parser
defineInfo.pointerTypes
also for partially specialized templates with default arguments - Tweak
Pointer.formatBytes()
to increase the number of digits returned (issue #240) - Enhance
InfoMap
andStringAdapter
with default mappings and casts forstd::wstring
- Templatize
StringAdapter
to allow other character types likewchar_t
and add corresponding@StdWString
annotation - Prevent
Loader
from creating symbolic links to rename libraries, which does not always work - Fix memory leak that occurs with "org.bytedeco.javacpp.nopointergc" (issue #239)
- Make
Generator
useGENERIC_EXCEPTION_TOSTRING
macro onGENERIC_EXCEPTION_CLASS
instead of the defaultwhat()
- Fall back on Android-friendly
System.loadLibrary()
inLoader.load()
instead of "java.library.path" (issue bytedeco/javacv#970) - Add to Java enums an
intern()
method and use it intoString()
to return non-null strings - Add
PointerScope
to manage more easily the resources of a group ofPointer
objects - Fix
Parser
failing onconst void*&
or similar function arguments, and on constructors of class templates - Add
Info.skipDefaults
to have theParser
ignore default function arguments and prevent method overloading - Accelerate copy and extraction of resources by using larger buffers for file operations
- Fix
Parser
incorrectly referring to function arguments with impossibly qualified names - Allow using
new Info().enumerate()
to map all C++enum
to Javaenum
types by default - Fix
Parser
issues surrounding enum classes, anonymous namespaces, and pure virtual classes - Avoid
synchronized
on first call tophysicalBytes()
inPointer.deallocator()
to reduce contention (pull #232)
- Enhance
Loader.createLibraryLink()
by allowing to create symbolic links in other directories - Fix
Parser
failing onenum
declarations where the first line is a macro (issue #230) - Make call to
Pointer.physicalBytes()
thread safe and remove lock (issue #231) - Add
Info.enumerate
to letParser
map C++ enum classes to Java enum types (issue #108) - Prevent
Loader
from loading twice copies of the same DLL (issue deeplearning4j/deeplearning4j#4776) - Add a
BuildMojo.targetDirectory
parameter to set a directory containing Java files generated bybuildCommand
- Fix missing
jnijavacpp.cpp
when processing classes from different packages (issue #228) - Enhance
Loader.addressof()
by making it try harder to find symbols on Linux and Mac OS X - Add
get()
andtoString()
methods to basic containers defined inParser
- Fix
Parser
ignoringInfo.define
and other information for macros actually defined - Fix
SharedPtrAdapter
andUniquePtrAdapter
failing to take ownership of temporary objects - Fix properties for
android-arm64
andandroid-x86_64
platforms that need API level 21 - Add "org.bytedeco.javacpp.pathsfirst" system property to let users search "java.library.path", etc before the class path
- Add
Parser
support for_Bool
,_Complex
,_Imaginary
,complex
,imaginary
types from C99 - Fix
Generator
incorrectly splitting type names for template arguments containing function types - Fix
NullPointerException
inBuilder
when copying resources for static libraries - Let
Generator
pick up@NoException
annotations from super classes as well - Add
-stdlib=libc++
option to iOS properties, required byclang++
to support C++11 (pull #221) - Make it possible to define read-only containers with
Parser
by prependingconst
(issue #223) - Fix
Parser
failure of variable or function declarations on names starting with::
, among other various small issues - Access elements of basic containers defined in
Parser
withat()
instead ofoperator[]
(issue #223) - Add third element to
@Const
annotation to supportvirtual const
functions (pull #224) - Create more symbolic links to libraries preloaded by
Loader
to satisfy libraries like MKL - Work around in
Builder
the inability to pass empty arguments on Windows - Catch more exceptions that can occur in
Loader
when caching resources (pull #226) - Add
.a
as an allowed library extension for iOS so they can get bundled - Fix
Parser
failing on variables with direct list initialization{ ... }
(issue #223) - Allow
Parser
to map and cast function pointers toPointer
- Output to log all commands executed for
Builder.buildCommand
viaProcessBuilder
- Switch architecture in
android-arm.properties
to ARMv7-A - Fix
Parser
not producing@Cast
annotations for types withInfo.cast()
onoperator()
, as well as failing onusing operator
statements - Fix
Parser
issue with multiple container types (std::vector
, etc) getting mixed up when mapped to adapters (@StdVector
, etc) - Fix "Negative Buffer Capacity" errors happening in subclasses on
Pointer.asBuffer()
(issue deeplearning4j/deeplearning4j#4061) - Prevent
JNI_OnLoad()
from failing whenLoader.putMemberOffset()
cannot find a class - Throw clear error message when
Loader.load()
gets called on a class not supporting current platform - Create symbolic links to libraries preloaded by
Loader
as needed on Mac for renamed libraries - Update platform properties to support recent versions of the Android NDK
- Fix
Generator
issues with@ByPtrPtr
return ofString
orPointer
types (issue bytedeco/javacpp-presets#499) - Define
clear()
,empty()
,pop_back()
, andpush_back()
for resizable basic containers inParser
(issue bytedeco/javacv#659) - Add "nowarnings" option for the
@Platform(compiler=...)
value to suppress all warnings - Have
Builder
generate base JNI functions intojnijavacpp.cpp
for better iOS support (issue #213) - Output single value setters for containers in
Parser
to avoid surprises (issue #217) - Add
Parser
support for C++11using
declarations inheriting constructors (issue bytedeco/javacpp-presets#491) - Fix compiler error when defining
std::set
orstd::unordered_set
withParser
- Make
Parser
honorInfo.skip()
for enumerators and function pointers as well - Add
LoadEnabled
interface to allow classes to modify theirClassProperties
at runtime - Move
sizeof()
andoffsetof()
data to global variables to preventStackOverflowError
inJNI_OnLoad()
(issue bytedeco/javacpp-presets#331) - Propagate within
Parser
type information from macros to other macros referencing them - Add support for
JNI_OnLoad_libname()
naming scheme for iOS via newplatform.library.static=true
property - Improve the clarity of error messages on
Parser
failures - Fix
Parser
issues with multipletypedef
declarations in a single statement - Require
Info.annotations("@Name")
to pick up alternate names from attributes - Add
@Platform(exclude=...)
annotation value to remove header files from inherited@Platform(include=...
- Fix a few issues with
Parser
, including missingPointerPointer
member setters (issue bytedeco/javacpp-presets#478) - Fix potential race conditions and various issues with
Loader
that could prevent libraries like MKL from working properly - Add
Loader.addressof()
to access native symbols, usable via optionalValueGetter/ValueSetter
inFunctionPointer
- Add
BuildEnabled
interface to allowInfoMapper
classes to participate in the build - Try to use symbolic links in
Loader.load()
for output filenames specified with the#
character (useful for libraries like MKL) - Fix
Parser
incorrectly resolving type definitions with classes of the same name in parent namespaces - Fix
Generator
compile errors forconst
template types of@Adapter
classes using the@Cast
annotation - Call
Loader.createLibraryLink()
when executing the user specifiedBuilder.buildCommand
as well - Introduce new
platform.extension
property to manage more than one set of binaries per platform - Catch
SecurityException
inLoader.getCacheDir()
(pull #198)
- Call
malloc_trim(0)
afterSystem.gc()
on Linux to make sure memory gets released (issue bytedeco/javacpp-presets#423) - Make public the
Pointer.formatBytes()
andPointer.parseBytes()
static methods - Use
Integer.decode()
instead ofparseInt()
on integer literals to support hexadecimal and octal numbers - Add
Builder.encoding
option to let users specify I/O character set name (issue bytedeco/javacpp-presets#195) - Prevent race condition that could occur in
Loader.cacheResource()
(pull #188) - Fix potential compile errors with Android caused by superfluous
typedef
fromGenerator
(issue #186) - Fix
Parser
translation of strings containing the "::" subsequence (issue #184) - Prevent
Parser
from overwriting target classes when nothing was parsed - Fix
Parser
error on member variables with initializers plusInfo.skip()
(issue #179) - Fix
Parser
incorrectly recognizing values as pointers whenconst
is placed after type (issue #173) - Add
Parser
support for C++11using
declarations that act astypedef
(issue #169) - Let
Parser
accept variables initialized with parentheses (issue #179) - Fix
Parser
confusion between attributes and namespace-less templates (issue #181) - Fix issue with
Loader.getCallerClass()
when aSecurityManager
cannot be created (issue #176) - Make it possible to rename enumerators of C++
enum class
(issue #180) - Make the arbitrary resources available to process executed with
Builder.buildCommand
via theBUILD_PATH
environment variable - Prevent
Parser
from outputting setters forconst
member pointers - Add support for arrays of function pointers
- Let users bundle arbitrary resources, have them extracted in cache, and used as
include
orlink
paths (pull #43) - Fix potential formatting issues with
OutOfMemoryError
thrown fromPointer
- Fix
Loader.getCallerClass()
not using the output from theSecurityManager
(pull #175) - Fix
Parser
not considering emptyclass
,struct
, orunion
declarations as opaque forward declarations - Provide
ByteIndexer
andBytePointer
with value getters and setters for primitive types other thanbyte
to facilitate unaligned memory accesses - Add a
BuildMojo.buildCommand
parameter that lets users execute arbitrary system commands easily withProcessBuilder
- Add new "org.bytedeco.javacpp.cachedir.nosubdir" system property to restore old behavior (issue #167)
- Prevent
Pointer
from copying array data from NIO buffers that are also direct (issue bytedeco/javacpp-presets#380) - Fix
SharedPtrAdapter
andUniquePtrAdapter
of theGenerator
forconst
types (issue #166) - Prevent
Loader
from loading system libraries, which causes problems on Android 7.x (issue bytedeco/javacv#617) - Make
Parser
strip return type annotations when namingFunctionPointer
(issue #162) - Let
Pointer
log debug messages when forced to callSystem.gc()
- Fix
Parser
handling ofstd::map
and of documentation comments containing the "*/" sequence - Add portable and efficient
totalPhysicalBytes()
,availablePhysicalBytes()
,totalProcessors()
,totalCores()
,totalChips()
methods - Avoid
Loader
issues with spaces, etc in paths to library files (issue deeplearning4j/nd4j#1564) - Prevent
Generator
from creating duplicateusing
statements (pull #158) - Make
Pointer.asBuffer()
thread-safe (issue #155)
- Fix broken
outputDirectory
property and corresponding-d
command line option (issue #153) - Add
Loader.extractResources()
andcacheResources()
methods to extract or cache all resources with given name - Fix potential issues with
Parser
repeating the@ByPtrPtr
or@ByPtrRef
annotations on parameters - To support Scala singleton objects better, consider as
static
methods from objects that are notPointer
- Allow
Loader.extractResource()
andcacheResource()
to extract or cache all files from a directory in a JAR file - Create version-less symbolic links to libraries in cache on those platforms where it is useful to link easily
- Use
java.io.tmpdir
as fallback inLoader.getCacheDir()
, and throw a clear exception on failure
- Print memory sizes in a human-readable format with
Pointer.formatBytes()
- Map standard
malloc()
,calloc()
,realloc()
, andfree()
functions (issue #136)
- Fix
Loader
errors that could occur due to recent changes
- Improve
Loader
handling of duplicate libraries found in different JAR files using symbolic links (useful for MKL, etc) - Prevent
Loader
from overwriting previously extracted and renamed libraries (issue deeplearning4j/nd4j#1460) - Allow users to define
NO_JNI_DETACH_THREAD
to prevent callbacks from reinitializing threads (issue #143)
- Add support for
decltype()
declarations to theParser
(issue #135) - Fix
Generator
when aFunctionPointer
contains methods that start with "get" or "put" (issue #137) - Enhance
Parser
to let users skip the default values of arguments, as well as classes when one base class is skipped - Fix
Parser
not properly mapping the type oflong
anonymous enums - Take into account
const
on function parameters when looking up inInfoMap
, and fix some incorrectly translated macros into variables - Add to
InfoMap.defaults
more names that are reserved in Java, but not in C++ - Add via
@ByPtrRef
support for function pointers passed by reference, as well as support forInfo.javaText
withtypedef
- Make sure
Parser
exhausts all combinations of method parameter types even with duplicates (issue bytedeco/javacv#518) - Make
Loader
cache libraries (in~/.javacpp/cache/
by default) instead of using temporary files (pull #120) - Have
Parser
annotate theallocate()
functions and not the actual constructors (issue bytedeco/javacpp-presets#297) - Fix
Parser
handling ofclass
,struct
, orunion
types with variables declared in the same statement - Add missing
platform.link
topsapi
required by some versions of Visual Studio (issue bytedeco/javacpp-presets#298) - Make sure default values placed in
nullValue
by theParser
have the right type (issue bytedeco/javacv#518) - Accelerate call to
Pointer.physicalBytes()
on Linux (issue #133) - Fix
Parser
incorrectly skipping over some template function declarations - Allow C++ types to be prefixed by
class
,struct
, orunion
to work around name clashes (pull bytedeco/javacpp-presets#266) - Properly expand the special predefined
__COUNTER__
macro (pull bytedeco/javacpp-presets#266) - Create all missing directories in the paths to the source files created by
Generator
- Insure
Parser
properly ignores theauto
,mutable
,register
,thread_local
, andvolatile
C++ keywords for storage classes - Fix
Generator
andParser
for types likestd::unordered_map<std::string,std::pair<int,int> >
(pull bytedeco/javacpp-presets#266) - Add
std::forward_list
,std::priority_queue
,std::unordered_map
, andstd::unordered_set
to the list of "basic/containers" inInfoMap
- Work around
linux-armhf
not being properly detected with OpenJDK (issue #105) - Fix
Parser
not accepting namespace aliases with::
tokens in them (issue bytedeco/javacpp-presets#265) - Add "org.bytedeco.javacpp.maxphysicalbytes" system property to force calls to
System.gc()
based onPointer.physicalBytes()
- Allow strings ending with "t", "g", "m", etc to specify the number of bytes in system properties (issue #125)
- Add
Info.linePatterns
to limit the lines from header files that theParser
has to process - Introduce "platform.compiler.hardfpu" option inside
android-arm.properties
to targetarmeabi-v7a-hard
- Add
UniquePtrAdapter
and corresponding@UniquePtr
annotation to supportunique_ptr
containers (pull bytedeco/javacpp-presets#266) - Fix
Parser
not expectingfriend class
declarations that start with::
(pull #122) - Synchronize memory allocation in
Pointer
to avoidOutOfMemoryError
when low on memory - Make it clear that
Indexable.createIndexer()
can throw aNullPointerException
(issue bytedeco/javacv#437) - Escape quotes when parsing default value for the
nullValue
of@ByRef
or@ByVal
(pull #119) - Let
Parser
accept identifiers in addition to integer literals for bit fields (issue #118) - Fix
Loader.load()
not renaming a library when previously loaded under a different name
- Add support for data member pointers as pseudo-
FunctionPointer
(issue #114) - Change the packaging type to
jar
sincemaven-plugin
causes issues with sbt and Ivy (issue #113) - Include new
platform.compiler.debug
options inside the default properties file (pull #90) - Always use the
platform.compiler.default
options unless@Platform(compiler="!default", ...)
is specified - Move optimization options from
platform.compiler.output
toplatform.compiler.default
, allowing users to override - Create all missing directories in the path to the target file of
Parser
- Parse properly custom
enum
types, found after the ':' token in C++11 - Output compiled libraries to user specified class path by default for input classes inside JAR files, etc
- Add
HalfIndexer
to accessshort
arrays as half-precision floating point numbers
- Prevent creating unnecessary garbage when using
Indexer
on simple arrays with a stride of 1 (issue deeplearning4j/nd4j#1063) - Add "org.bytedeco.javacpp.maxretries" system property, the number times to call
System.gc()
before giving up (defaults to 10) - Deallocate native memory in a dedicated thread to reduce lock contention (issue #103)
- Fix Javadoc links for externally referenced classes
- Prevent Android system libraries from getting copied or extracted
- Insert in
Indexer
anindexable
field optionally set by the user for convenience - Fix potential
ParserException
on comments found after annotations before function declarations - Fix
IndexerTest
potentially failing withOutOfMemoryError
(issue bytedeco/javacpp-presets#234) - Preload libraries to work around some cases when they refuse to load once renamed (issue deeplearning4j/libnd4j#235)
- Fix compilation error on some
linux-ppc64le
platforms (issue deeplearning4j/libnd4j#232) - Make sure
Generator
definesJavaCPP_getStringBytes()
to handle exception messages when using callbacks
- Fix
Loader
crashing on Android (issue bytedeco/javacv#412) - Fix
NullPointerException
on "generic" platforms - Throw
OutOfMemoryError
onallocateArray()
forPointer
of primitive types withsize > 0 && address == 0
(issue deeplearning4j/nd4j#960) - Add the ability the specify, after a
#
character, the output filename of libraries extracted byLoader.load()
- Consider
FunctionPointer
annotated with empty@Namespace
as non-member function pointers (issue #99)
- Fix
NullPointerException
inBuilder
on invalidjava.home
system property or inaccessible directories - Add parameters to
Loader.load()
offering more flexibility over the platform properties and library paths - Treat all
String
withCharset.defaultCharset()
(or defineMODIFIED_UTF8_STRING
for old behavior) (issue #70) - Fix
NullPointerException
inParser
on variadic templates (issue #81) - Fix
Loader.load()
error when called right afterBuilder.build()
within the same process - Lower Maven prerequisite in the
pom.xml
file to 3.0 (issue #93) - Use
Info.cppTypes
for allParser
type substitutions, in addition to macros and templates (issue bytedeco/javacpp-presets#192) - Make
Parser
take into account Java keywords not reserved in C++, casting issues withint64_t
, andconst
value types in basic containers - Let users define
NATIVE_ALLOCATOR
andNATIVE_DEALLOCATOR
macros to overload globalnew
anddelete
operators - Map
jint
toint
andjlong
tolong long
on Windows as well as all platforms with GCC (or Clang) - Fix corner cases when checking for the platform in
Generator
andParser
- Link libraries with "-z noexecstack" on Linux as recommended by HotSpot (pull #90)
- Set the internal DT_SONAME field in libraries created for Android (issue bytedeco/javacpp-presets#188)
- Add "org.bytedeco.javacpp.maxbytes" system property, forcing a call to
System.gc()
when this amount of memory tracked with deallocators is reached - Let
Parser
pick upInfo.annotations
in the case of function pointers as well - Add
@Convention(extern=...)
value to haveGenerator
produceFunctionPointer
with other language linkage than "C" - Enhance the
indexer
package withlong
indexing, initially via thesun.misc.Unsafe
, for now - Lengthen the
position
,limit
, andcapacity
fields ofPointer
usinglong
- Prevent creating text relocations for shared libraries on Android, which are rejected by recent versions of the SDK
- Use the
outputDirectory
as the compiler's working directory (pull #89) - Comment with first dimension of multidimensional array inside
@Cast
(pull #87) - Remove
throws Exception
fromPointer.close()
since destructors do not typically throw exceptions (pull #86) - Add
-nodelete
flag to keep generated C++ files after compilation (pull #85) - Annotate functions originating from
cinclude
with@NoException
(pull #84) - Call
JNI_ABORT
on release ofconst
arrays (pull #83) - Add support for C++11
default
anddelete
on function declarations (issue #80) - Add support for C++11 typed
enum
, with or without enumerator list (issue #78) - Add missing space for
const
types when normalizing template arguments inParser
(issue bytedeco/javacpp-presets#165) - Make
Builder
fail onClassNotFoundException
orNoClassDefFoundError
instead of logging warnings - Allow
Builder
to generate native libraries with empty@Platform
annotation even without user definednative
methods - Enhance
Parser
to support a bit better&&
tokens and C++11 rvalue references (issue bytedeco/javacpp-presets#160) - Add properties for the
linux-armhf
,linux-ppc64
, andlinux-ppc64le
platforms, and pick upmacosx
whenos.name
isdarwin
- Fix
NullPointerException
inParser
on unexpected forms of function pointers (issue #70) - Make sure
Generator
produces calls tosizeof()
andoffsetof()
for allPointer
classes with allocators - Let
Parser
use adapters in the case ofFunctionPointer
as well (issue bytedeco/javacpp-presets#145) - Prepend "javacpp." to all properties associated with Maven in
BuildMojo
to avoid name clashes - Let users define the
GENERIC_EXCEPTION_CLASS
macro (default ofstd::exception
) to indicate the base exception thrown by native methods - Split type names at
::
delimiters before mapping them against templates inParser
- Fix swallowed
InterruptedException
(issue bytedeco/javacv#315) - Adjust a few things in
Generator
preventing@Virtual
from working properly in some cases (issue bytedeco/javacpp-presets#143) - Fix
TokenIndexer
inserting an invalid token while expanding macros ending with a backslash (issue #63) - Make
Parser
takeInfo.skip
into account forenum
declarations as well - Improve the performance of
BytePointer.getString()
by usingstrlen()
- Prevent
Generator
from initializing classes when preloading them, which can cause problems (issue bytedeco/javacpp-presets#126) - Add
Info.flatten
to duplicate class declarations into their subclasses, useful when a subclass pointer cannot be used for the base class as well - Prevent
Loader
from extracting libraries more than once, which can cause problems (issue bytedeco/javacpp-presets#126) - Make
Indexer implements AutoCloseable
to let us try-with-resources - Add missing calls to
close()
forInputStream
andOutputStream
inLoader
(issue #53) - Remove
Piper
class no longer needed with Java SE 7 - Let
Parser
place appropriateInfo.javaText()
provided by users in the case of destructors as well - Fix the
Parser
skipping over some declarations by mistake and producing invalid comments for macros - To let users specify
...
varargs asInfo.pointerTypes()
, have theParser
replace them with array[]
when not found on the last parameter - Enhance basic support for containers of the style
std::vector<std::pair< ... > >
with user-friendly array-based setter methods - Fix
Generator
not passing function objects even when annotatingFunctionPointer
parameters with@ByVal
or@ByRef
- Map
bool*
toboolean[]
tentatively inParser
sincesizeof(bool) == sizeof(jboolean)
on most platforms - Allow
Parser
to generate@Cast()
annotations and overloadedput()
methods in basic containers too - Move list of basic containers and types to
Info.cppTypes
of the "basic/containers" and "basic/types"InfoMap
entries, letting users change them at build time - Fix some
Parser
issues withtypedef
and forward declarations insideclass
definitions - Insure
Parser
maps 64-bit values in C++enum
tolong
variables (issue #48) - Fix
Generator
trying to cast improperly objects on return from@Virtual
functions - Make
Parser
takeconstexpr
,nullptr
, andnamespace
aliases into account, and fix a couple of preprocessing issues withTokenIndexer
- Fix primitive arrays and NIO buffers not getting updated on return when used as arguments with adapters (issue bytedeco/javacpp-presets#109)
- Enhance a bit the conversion from Doxygen-style documentation comments to Javadoc-style
- Remove class check in allocators, which prevented peer classes from being extended in Java, instead relying on
super((Pointer)null)
in child peer classes, and remove confusing and now unnecessary empty constructors
- Make
Generator
use actual C++ operators for commonly overloaded ones instead of callingoperator??()
functions, for better portability - Fix potential race condition when deallocating
Pointer
objects from multiple threads - Add logging to
Loader.loadLibrary()
to help diagnose loading problems (issue #41) - Provide new
@Platform(pragma=...)
value to haveGenerator
output#pragma
directives - Upgrade all Maven dependencies and plugins to latest versions, thus bumping minimum requirements to Maven 3.0
- Add new "org.bytedeco.javacpp.cachedir" system property to specify where to extract and leave native libraries to share across multiple JVM instances
- Provide
@Virtual(true)
to specify pure virtual functions and preventGenerator
from making undefined calls - Update properties for Android to detect undefined symbols at compile time, instead of getting errors only at runtime
- Log when
Pointer.deallocator
gets registered, garbage collected, or deallocated manually, ifLogger.isDebugEnabled()
(redirectable to SLF4J) - Make
Pointer implements AutoCloseable
to let us try-with-resources, thus bumping minimum requirements to Java SE 7 and Android 4.0 - Introduce the concept of "owner address" to integrate
Pointer
transparently withstd::shared_ptr
, etc (Thanks to Cyprien Noel for the idea!) - Add new "cpp11" option for the
@Platform(compiler=...)
value to build against the C++11 standard - Fix
Parser
support for theinterface
keyword of the Microsoft C/C++ Compiler - Let
Parser
pick up names fromInfo.pointerTypes
in the case of function pointers as well - Add new "org.bytedeco.javacpp.nopointergc" system property to prevent
Pointer
from registering deallocators with the garbage collector - Add
@Properties(names=...)
value to specify a list of default platform names that can be inherited by other classes - Fix a couple of
Parser
issues on complex template types (issue #37) - Take into account
Buffer.arrayOffset()
when creating aPointer
from a buffer backed by an array (issue bytedeco/javacv#190) - Fix some incorrectly translated comments in
Parser
(issue #32) - Add
Parser
support for thestd::bitset
"container", and a bug involving simple types and skipped identifiers - Properly parse overloaded
new
anddelete
operators,friend
declarations, and default constructors with an explicitvoid
parameter (issue #31) - Fix a couple of potential
NullPointerException
inParser
(issue #30) - Have the
Parser
wrap theiterator
of some standard C++ containers when useful - Use Clang as the default compiler for Mac OS X and iOS (via RoboVM)
- Adjust
BytePointer
,CharPointer
,IntPointer
, andStringAdapter
to work with data strings that are not null-terminated (issue #24) - Forbid
Parser
from producingabstract
classes, preventing C++ factory methods and such from working properly (issue #25) - Fix crash when trying to create objects from abstract classes, to let the exception be thrown on return (issue #26)
- Switch to GCC 4.9 by default on Android, probably dropping support for Android 2.2, because GCC 4.6 has been dropped from the NDK since r10e
- Insure
Generator
casts properly tojweak
when callingDeleteWeakGlobalRef()
(issue #23)
- Add
-undefined dynamic_lookup
option to Mac OS X compiler, making its native linker behave a bit better, plus search for libraries suffixed with ".so" too - Add missing
@Platform(frameworkpath=...)
value and corresponding property to set custom framework paths for the linker - Add
Parser
support for theinterface
keyword of the Microsoft C/C++ Compiler - Fix
Generator
performance issue on classes with a lot of methods (issue bytedeco/javacpp-presets#36) - Offer the Apache License, Version 2.0, as a new choice of license, in addition to the GPLv2 with Classpath exception
- Fix
NullPointerException
when trying to process aninterface
class - Fix
Parser
errors on unnamednamespace
blocks, preprocessor directives with comments, and empty macros - Introduce a
nullValue
to@ByRef
and@ByVal
annotations to let us specify what to do when passednull
- Add properties for
android-arm64
,android-x86_64
, andlinux-arm64
platforms - Add slow but generic
Indexer.putDouble()
to complement existingIndexer.getDouble()
(useful for testing) - Fix and enhance in various ways the support of
Parser
andGenerator
for function pointers, virtual functions, and abstract classes - Improve
Parser
check forconst
references and pointers required to output appropriate@Const
annotation - Add
Info.purify
to force theParser
in producing abstract classes - Let
StringAdapter
(via the@StdString
annotation) supportstd::string*
, that is to say, pointers to strings - Fix
Tokenizer
failing on some character and string literals - Fix
Parser
errors caused by constructors intypedef struct
constructs, included nested ones, and skip over pointer names too (issue bytedeco/javacpp-presets#62) - Generalize
Info.virtualize
to let non-pure virtual functions get annotated with@Virtual native
- Make
VectorAdapter
work even with elements that have no default constructor - Add
Parser
support forstd::pair
as a sort of zero-dimensional container type - Fix
Parser
crash on empty comments (issue #14)
- Clarify with documentation comments various constructors produced by the
Parser
- Add
SharedPtrAdapter
and corresponding@SharedPtr
annotation to supportshared_ptr
containers - Fix a few small issues and work around a few additional corner cases with the
Parser
and theGenerator
- Provide
UByteIndexer
andUShortIndexer
, treating array and buffer data as unsigned integers, for ease of use - Clean up Windows
java.io.tmpdir
even when program messes withjava.class.path
(issue #12) - In addition to direct NIO buffers, also accept as function arguments non-direct ones backed by arrays (issue bytedeco/javacpp-presets#36)
- Fix
@Virtual
callback functions defined inside a@Namespace
- Adjust
TokenIndexer
andParser
to handle#if
,#ifdef
,#ifndef
,#elif
,#else
, and#endif
preprocessor directives more appropriately, even when placed in the middle of declarations - Append
@Documented
to annotation types to have them picked up by Javadoc - Fix
friend
functions not getting skipped by theParser
- Add
Info
for__int8
,__int16
,__int32
, and__int64
toInfoMap.defaults
- Fix multiple "platform.preload" or "platform.preloadpath" properties not getting considered by the
Loader
- Fix some
Parser
exceptions on valid declarations with template arguments, macro expansions, or overloaded cast operators, and makeInfo.javaName
usable in the case ofenum
- Disable DocLint, which prevents the build from succeeding on Java 8 (issue #5)
- Add new
indexer
package containing a set ofIndexer
for easy and efficient multidimensional access of arrays and buffers (issue javacv:317) - Use
Long.decode()
inside theTokenizer
to test more precisely when integer values are larger than 32 bits - Have the
Parser
produce@Name("operator=") ... put(... )
methods for standard C++ containers, avoiding mistaken calls toPointer.put(Pointer)
(issue bytedeco/javacv#34) - Let the
Parser
applyInfo.skip
in the case of macros as well - Remove warning log messages when using the
@Raw
annotation - Let
@Virtual @MemberGetter
annotated methods return member function pointers of functions defined with@Virtual
, useful for frameworks like Cocos2d-x - Fix
NullPointerException
when leaving theincludePath
,linkPath
, orpreloadPath
Mojo parameter empty - Add
Info.virtualize
to have theParser
generate@Virtual abstract
for pure virtual functions in the given classes - Add
@Virtual
annotation and updateGenerator
to support callback by overriding such annotatednative
orabstract
methods - Add hack for
typedef void*
definitions and parameters with a double indirection to them
- Fix
Generator.checkPlatform()
not checking super classes - Add
includePath
,linkPath
, andpreloadPath
parameters toBuildMojo
to let Maven users append paths to the properties easily - In consequence, remove too arbitrary "local" paths from the default platform properties (issue #43)
- Fix a few other more or less minor issues in the
Parser
with thelong double
,ptrdiff_t
,intptr_t
,uintptr_t
,off_t
types, floating-point numbers, macro redefinitions, access specifiers, casting of const values by reference, optional parentheses, const data types in templates, declarator names equal to a type name, friend functions, inline constructors,typedef void
declarations within namespaces, pointers to function pointers - Allow users to instruct the
Parser
to skip the expansion of specific macro invocations - Let
Parser
concatenate tokens when expanding macros containing the##
operator - Add some documentation for
Info
,InfoMap
,InfoMapper
, andParser
- Fix the
Parser
not filtering and expanding properly some preprocessor directives, as well as producing wrong code fortypedef struct *
- Skip Java path search when building for Android to prevent including some random
jni.h
file (issue #3) - Fix the
Parser
losing some keywords likestatic
on methods annotated with an@Adapter
(issue #2) - Fix
Loader.load()
not properly force loading all inherited target classes (issue #1)
- Move from Google Code to GitHub as main source code repository
- Place build-time classes in the
org.bytedeco.javacpp.tools
package and bring out static nested classes, in an effort to avoid conflicts and ease development - Rename the
com.googlecode.javacpp
package toorg.bytedeco.javacpp
- Added
public long Pointer.address()
getter method, useful when one needs to subtract two pointers - Removed old NetBeans project files that cause a conflict when trying to open as a Maven project (issue javacv:210)
- Fixed compilation error on
FunctionPointer
classes containing no native callback methods - Added a
platform.library.path
property, such as "lib/armeabi/" in the case of the "android-arm" platform, to be used instead of "package/platform" (issue javacv:427) - Generalized references to the path of the Android NDK
- Improved a few small things in the set of
Pointer
classes - Introduced a simple
Logger
class and unified the logging output calls around it - Unified the property names with the
@Properties
and@Platform
annotations into a consistent naming scheme - Continued to clean up the
Parser
and improve the support of, for the most part, comments, enumerations, functions pointers, anonymousstruct
orunion
, templates, overloaded operators, namespaces, standard containers, default parameter arguments, multiple inheritance, custom names of wrapped declarators, and helper classes written in Java - Annotations such as
@Adapter
or@ByVal
are no longer ignored on parameters of getters or setters annotated with@Index
- Fixed some other corner cases in
Generator
and a few potential issues with the hacks inLoader
- Added for convenience to
PointerPointer
a generic parameter<P extends Pointer>
and the associatedget(Class<P> ...)
getters, as well asString
getters and setters - Passing a
Class
object as first argument to a native method that returns aPointer
now determines the runtime type of that returned object - Generalized somewhat more the compiler options used inside
linux-arm.properties
(issue javacv:418) - Unified the function pointer type of native deallocators to
void (*)(void*)
- Removed dependency on (efficient)
AllocObject()
andCallNonvirtualVoidMethodA()
JNI functions, which are not supported by Avian - Cleaned up and optimized
Generator
a bit, also fixing a crash that could occur whenFindClass()
returnsNULL
- Tweaked a few things to support RoboVM and target iOS, but
JNI_OnLoad()
does not appear to get called... - Upgraded references of the Android NDK to version r9c
- Made
Loader.load()
work, within reason, even when all annotations and resources have been removed, for example, by ProGuard - Fixed compile error when using a
FunctionPointer
as parameter from outside its top-level enclosing class - Added new
Pointer.deallocate(false)
call to disable garbage collection on a per object basis, allowing users to deal with memory leaks in other ways - Changed the default compiler option
-mfpu=vfpv
for ARM to-mfpu=vfpv3-d16
, because the former is not supported by Tegra 2 (issue javacv:366) - Removed call to
Arrays.copyOf()
inLoader.findLibrary()
, which would prevent it from working on Android 2.2 (issue #39) - Fixed invalid code generated for
FunctionPointer
parameters annotated with@Const @ByRef
- Fixed
NullPointerException
inLoader.load()
when no@Platform
annotation is provided (issue #38) - Parsing for anonymous
struct
orunion
and fortypedef void
(mapped to@Opaque Pointer
) now outputs something - The
Parser
now expands preprocessor macros, filters tokens appropriately, and outputs all unprocessed directives as comments - Improved the C++ support of the
Parser
for namespaces, derived classes, access specifiers, custom constructors, vector types, macros, templates, overloaded operators, etc - Fixed
typedef
of function pointers and a few code formatting issues withParser
- Supplied checks to prevent
Loader.load()
from throwingjava.lang.IllegalStateException: Can't overwrite cause
- Added new very preliminary
Parser
to produce Java interface files almost automatically from C/C++ header files; please refer to the new JavaCPP Presets subproject for details - When catching a C++ exception, the first class declared after
throws
now gets thrown (issue #36) instead ofRuntimeException
, which is still used by default - Fixed Java resource leak after catching a C++ exception
- Upgraded references of the Android NDK to version r9
- Added new
Builder
option "-copylibs" that copies into the build directory any dependent shared libraries listed in the@Platform(link={...}, preload={...})
annotation Loader.getPlatformName()
can now be overridden by setting thecom.googlecode.javacpp.platform.name
system property- Refactored the loading code for
@Properties()
into a neatLoader.ClassProperties
class, among a few other small changes inLoader
,Builder
,Generator
, and the properties - Included often used directories such as
/usr/local/include/
and/usr/local/lib/
tocompiler.includepath
andcompiler.linkpath
default properties - New
@Properties(inherit={Class})
value lets users specify properties in common on a similarly annotated shared config class of sorts - Fixed callbacks when used with custom class loaders such as with Web containers or frameworks like Tomcat and Play
- Fixed using
@StdString
(or other@Adapter
with@Cast
annotations) on callbacks (issue #34), incidentally allowing them to return aString
- By default,
Builder
now links to thejvm
library only when required, when using the-header
command line option (issue #33) - Incorporated missing explicit cast on return values when using the
@Cast
annotation - Fixed duplicate code getting generated when both specifying the output filename with
-o <name>
and using wildcards on packages containing nested classes - Let
Buffer
or arrays of primitive values be valid return and callback arguments, mostly useful when used along with the@StdVector
annotation, or some other custom adapter
- Upgraded references of the Android NDK to version r8e
- Arguments of
Pointer
type now get handled aschar*
in cases when theposition
can be used for arithmetic - Worked around bug of
InputStream.available()
always returning 0 with thehttp
protocol inLoader.extractResource(URL)
- Fixed potential problem with methods of
FunctionPointer
annotated with@Cast("const...")
- Upgraded references of the Android NDK to version r8d
- Fixed callbacks not working on Android anymore (issue #30)
- Added some Javadoc to most of the code
- To help diagnose
UnsatisfiedLinkError
thrown byLoader.load()
, they have been augmented with a potential cause originating from the "preloading" of libraries, whose premature deletion has also been fixed - Provided new
@Platform(library="...")
annotation value to let users specify the name of the native library used by bothBuilder
andLoader
, where different classes with the same name get built together, which also works on nested classes (issue #29) - Added the ability to change the name of the class of function objects created when defining a
FunctionPointer
with the@Name
annotation Builder
would go on a compile spree when all classes specified on the command line could not be loaded- Exported
Loader.isLoadLibraries()
, which always returns true, except when theBuilder
loads the classes - Made it possible to specify a nested class (with a '$' character in the name) on the command line
- When
Pointer.limit == 0
, the methodsput()
,zero()
, andasBuffer()
now assume a size of 1 - Fixed compiler error on 32-bit Mac OS X
- Added
Pointer.withDeallocator(Pointer)
method to attach easily a customDeallocator
created out of astatic void deallocate(Pointer)
method in the subclass, including native ones such as@Namespace @Name("delete") static native void deallocate(Pointer)
- A name starting with "::", for example
@Name("::std::string")
or@Namespace("::std")
, now drops the remaining enclosing scope - Removed confusing
cast
value of@Adapter
instead relying on newString[]
value of@Cast
to order multiple casts - Renamed various variables in
Generator
to make the generated code more readable - Fixed memory corruption when using an adapter or
@ByRef
on a function that returns by value anstd::vector<>
orstd::string
(issue #26) - Added
Pointer.zero()
method that callsmemset(0)
on the range - For easier memory management, more than one
Pointer
now allowed to share thedeallocator
when "casting" them - Upgraded references of the Android NDK to version r8b
- Fixed
JavaCPP_log()
not printing correctly (issue #27) - Added functionality to access easily
FunctionPointer
callbacks by their names from C/C++: We can annotate them with@Name
and build with the new-header
option to get their declarations in a header file, while theBuilder
links with thejvm
library by default Loader
now displays an informative error message when trying to use an undefinedcompiler.options
with@Platform(options="")
(issue #24)Pointer.deallocator()
would needlessly enqueueDeallocator
objects pointing to the nativeNULL
address- Added support for C++ "functors" based on the
operator()
, which gets used when annotating aFunctionPointer
method parameter with@ByRef
or@ByVal
- For convenience in Scala, added
apply()
as an acceptable caller method name within aFunctionPointer
, in addition tocall()
- Fixed
@Cast
not working along parameters with an@Adapter
or when attempting toreturn
the argument Generator
would ignorePointer.position()
in the case of@ByPtrPtr
and@ByPtrRef
parameters- Replaced hack to create a
Pointer
from aBuffer
object with something more standard - Fixed
Loader.sizeof(Pointer.class)
to return thesizeof(void*)
- In addition to methods and parameters, we may now apply
@Adapter
to annotation types as well, allowing us to shorten expressions like@Adapter("VectorAdapter<int>") int[]
to just@StdVector int[]
, forstd::vector<int>
support, and similarly for@StdString
andstd::string
- Fixed callback parameter casting of primitive and
String
types - An empty
@Namespace
can now be used to letGenerator
know of entities that are not part of any scope, such as macros and operators - Turned
FunctionPointer
into anabstract class
withprotected
constructors, but if users still try to use it as function parameters,Generator
now logs a warning indicating that a subclass should be used (issue #23) - Removed the
out
value of the@Adapter
annotation: All adapters are now "out" by default, unless@Const
also appears on the same element - Fixed
Pointer.equals(null)
throwingNullPointerException
(issue #22) @NoOffset
would erroneously preventsizeof()
operations from getting generated
- Fixed problems when trying to map
java.lang.String
to other native types thanchar*
, such asunsigned char*
- JavaCPP now uses the
new (std::nothrow)
operator for allocation, which guarantees that allocation of primitive native arrays won't throw exceptions, making it possible to build C++ exception free JNI libraries - Added new
Pointer.limit
property, mainly useful to get thesize
of an output parameter, as returned by an adapter specified with the@Adapter
annotation - Renamed the
capacity
field of an adapter tosize
as it now maps to bothPointer.limit
andPointer.capacity
(the latter only for new allocations) - Added
Pointer.put(Pointer)
method, the counterpart ofBuffer.put(Buffer)
, to call the nativememcpy()
function on twoPointer
objects - New
@NoException
annotation to reduce the size of generated code and optimize runtime performance of functions that are guaranteed not to throw exceptions, or for cases when we do not mind that the JVM may crash and burn - Trying to generate code for non-static native methods inside a class not extending
Pointer
now generates proper warning (issue #19) - Fixed regression where the
@Adapter
notation generates incorrect code for types other thanPointer
(issue #20)
- Started using version numbers, friendly to tools like Maven, and placing packages in a sort of Maven repository (issue #10)
- Before loading a JNI library, the
Loader
now also tries to extract and load libraries listed in the@Platform(link={...}, preload={...})
annotation values, and to support library names with version numbers, each value has to follow the format "libname@version" (or "libname@@version" to haveBuilder
use it for the compiler as well), where "version" is the version number found in the filename as required by the native dynamic linker, usually a short sequence of digits and dots, but it can be anything (e.g.: "mylib@.4.2" would map to "libmylib.so.4.2", "libmylib.4.2.dylib", and "mylib.4.2.dll" under Linux, Mac OS X, and Windows respectively) - All files now get extracted into a temporary subdirectory, and with the appropriate platform-dependent linker options, or with libraries patched up after the fact with tools such as
install_name_tool
of Mac OS X, most native dynamic linkers can load dependent libraries from there - Stopped using
java.net.URL
as hash key inLoader
(very bad idea) - Changed the default value of the
@Index
annotation from 0 to 1, and fixed theGenerator
when it is used with member getters and setters - Renamed
mingw-*.properties
towindows-*-mingw.properties
for consistency - Made the
Generator
allocate native heap memory for callback arguments passed@ByVal
(in addition toFunctionPointer
), rendering their behavior consistent with return@ByVal
in the case of function calls (issue #16) Generator
now usesstd::runtime_error(std::string&)
instead of assuming that some nonstandardstd::exception(std::string&)
constructor exists (issue #17)- Fixed
Generator
producing incorrect code when applying invalid annotations such as@ByVal
on a method that returns something else than aPointer
object (issue #18)
- Added
pom.xml
file andBuildMojo
plugin class for Maven support and changed the directory structure of the source code to match Maven's standard directory layout (issue #10) Many thanks to Adam Waldenberg and Arnaud Nauwynck for their ongoing support with that! - Moved the source code repository to Git
- Created a new
@Raw
annotation to use Java object as rawjobject
in C++, also passingJNIEnv
and the enclosingjclass
or thejobject
corresponding tothis
, as the first two arguments of the function, when theGenerator
encounters any@Raw(withEnv=true)
(issue #13) - The
Builder
now handles more cases when some prefix or suffix property starts or ends with a space (issue #14) - Fixed syntax error in
VectorAdapter
, which GCC and Visual C++ would still happily compile - Added new
source.suffix
property to have the names of generated source files end with something else than.cpp
and support frameworks like CUDA that require filenames with a.cu
extension to compile properly, such as used by the new*-cuda.properties
, and also changed the "-cpp" command line option to "-nocompile" - New
Loader.loadLibrary()
method similar toSystem.loadLibrary()
, but before searching the library path, it tries to extract and load the library from Java resources Generator
now accepts@Const
onFunctionPointer
class declarations- Added new
@Adapter.cast()
value to cast explicitly the output of a C++ adapter object - Upgraded references of the Android NDK to version r8
- Included new command line option "-Xcompiler" to pass options such as "-Wl,-static" directly to the compiler
- Made other various minor changes and enhancements
- Added new
compiler.framework
property and corresponding@Platform.framework()
value to allow easier binding with Mac OS X frameworks - Changed most
Builder
errors into warnings, letting the building process complete successfully more often - We may now use the
@NoDeallocator
annotation on a class to disable deallocation for all allocation methods
- Added new
@NoDeallocator
annotation to preventallocate()
andallocateArray()
methods from registering a native deallocator toPointer
objects (issue #1) Generator
now properly skips as unsupported array parameters that do not have a primitive component type, and logs a warning (issue #7)Generator
andBuilder
would append the same include files, libraries, or options multiple times when not required: Fixed inLoader.appendProperty()
(issue #8)- Moved the placement of the class-level @Index annotation to the getter and setter methods themselves
- To process all classes in a package, we may now specify as argument to the
Builder
its name followed by ".*", in a similar fashion to theimport
statement of the Java language, or by ".**" to process recursively all packages, while omitting to specify any class or package results in JavaCPP processing all classes found under the directories or JAR files specified with the "-classpath" option (issue #12) - Equipped the
*Pointer
classes with new bulkget()
andput()
methods taking an array as argument, to compensate for direct NIO buffers lacking in performance on Android (issue #11)
- Cleaned up a few minor
Exception
blocks - New
Pointer.deallocateReferences()
static method to force immediate deallocation of all native memory allocated byPointer
objects that since have been garbage collected - Updated
android-arm.properties
to reflect the fact that, starting from Android NDK r7,libstdc++.a
has been surreptitiously renamed tolibgnustl_static.a
, such that JavaCPP was instead linking to a new boguslibstdc++.so
library, causing runtime linking errors - Included new
android-x86.properties
to compile binaries for that platform as well - Added new
compiler.sysroot.prefix
andcompiler.sysroot
platform properties to pass options such as--sysroot
to satisfy new rituals of the Android NDK starting from r7b - Upgraded references of the Android NDK to version r7b
- Added new
compiler.linkpath.prefix2
platform property to pass options such as-Wl,-rpath,
to linkers that support them - Fixed
Loader.load()
on Android 4.0, whereSecurityManager.getClassContext()
returnsnull
- Upgraded references of the Android NDK to version r7
- Changed the following to make MinGW work:
Generator
now mapsjlong
to the more standardlong long
instead of__int64
type and also includesstdint.h
, and added-D_JNI_IMPLEMENTATION_ -Wl,--kill-at
to the compiler options, as recommended by MinGW's documentation for building DLLs compatible with JNI - Added hack for
AttachCurrentThread()
, whose signature differs under Android, andDetachCurrentThread()
now gets called as appropriate after returning from a callback function, to prevent memory leaks (and also crashes on platforms such as Android) (issue #3) Generator
now generates correct code for the annotation pairs@Const @ByRef
and@Const @ByVal
(issue #4)- Worked around callback functions crashing on Android, which is unable to load user classes from native threads (issue #5)
- Fixed a few potential pitfalls inside
Generator
andLoader
- Removed compiler warnings due to the type of the
capacity
member variable ofVectorAdapter
- Callback
FunctionPointer
objects may now return@ByVal
or@ByRef
- On Android, changed the output of runtime error messages from
stderr
(equivalent to/dev/null
on Android) to the log
- Changed default option flag "/MT" to "/MD" (and a few others that Visual Studio uses by default) inside
windows-x86.properties
andwindows-x86_64.properties
becausestd::vector
,VectorAdapter
and C++ memory allocation in general does not work well with static runtime libraries across DLLs under Windows Vista and Windows 7 for some reason, and because Microsoft fixed the manifest file insanity starting with Visual C++ 2010 Builder
now searches forjni.h
andjni_md.h
inside/System/Library/Frameworks/JavaVM.framework/Headers/
if not found insidejava.home
, as with Mac OS X Lion (issue #2)- Upgraded references of the Android NDK to version r6b
- Fixed a few potential pitfalls inside
Generator
- Added hack to let
*Pointer
classes with a corresponding*Buffer
class have constructors for them
Generator
now letsget()/put()
(or theValueGetter/ValueSetter
annotated) methods use non-integer indices for theIndex
annotation- Removed calls to
Arrays.copyOf()
insidegetString*()
methods so they may work on Android as well - Fixed race condition that could occur in the deallocation code of
Pointer
due to incorrect synchronization platform.root
now defaults to the current directory
- New
Adapter
annotation that uses C++ classes such asVectorAdapter
, which can let us use Java arrays orPointer
objects in place of C++ vector objects by mapping types such asvector<int>
to@Adapter("VectorAdapter<int>") int[]
or@Adapter("VectorAdapter<int>") IntPointer
- Added new
Pointer.capacity
field to keep track of allocated size for arrays, needed by theAdapter
annotation - Removed the
capacity
parameter from thePointer.asByteBuffer()
andPointer.asBuffer()
methods, which now rely instead on the value of the newcapacity
field ValueGetter
andValueSetter
, defaulting to theget()
andput()
methods, now accept indices as arguments, and*Pointer
classes have been updated accordingly- New
Index
annotation to indicate that a C++ class, such asvector<T>
implements theoperator[]
that can be mapped to theValueGetter
andValueSetter
as well as to arbitrary function calls, taking the first n arguments as indices, where n is the value placed in the annotation - The
Name
annotation now accepts as value aString
array to indicate names before and after these indices - New
Const
annotation for convenience - Fixed scoping of static members inside namespaces and classes
- Added new
BoolPointer
class - Improved support of function pointers to generate more standard C++ and to make it work with things like member function pointers
- Inserted hack to call
std::string.c_str()
when returned as@ByRef java.lang.String
- Multiplied checks for invalid
NULL
pointers - Upgraded references of the Android NDK to version r5c, which now also works on Android 2.1 or older (android issue #16008)
Loader.load()
no longer requires a JVM that supports annotations to function properly
Generator
now outputs#include <stdio.h>
, the lack of which prevents Android NDK under Windows from compiling
- Replaced arrays from constructors with variable-length argument lists for convenience
- Fixed a few small potential pitfalls previously overlooked
- Fixed directory search for
jni_md.h
, which did not search deep enough in some cases - Added new
path.separator
property to set the path separator of the target platform, regardless of the build platform - Added hack to make sure the temporarily extracted library files get properly deleted under Windows
- Now loads classes more lazily
- Changed the paths for libstdc++ inside
android-arm.properties
to the non "v7a" versions - Added new
platform.root
property to let users specify the path to their toolchains more easily
Initial release
This project was conceived at the Okutomi & Tanaka Laboratory, Tokyo Institute of Technology, where I was supported for my doctoral research program by a generous scholarship from the Ministry of Education, Culture, Sports, Science and Technology (MEXT) of the Japanese Government. I extend my gratitude further to all who have reported bugs, donated code, or made suggestions for improvements (details above)!