BridJ 0.4 released (r1869): subclass C++ from Java, better Javadoc and many fixes
BridJ is an innovative native bindings library that lets Java programmers use native libraries (written in C, C++, ObjectiveC and more) in a very natural way (inspired by the great JNA, with better performance, C++ and generics added).
In this new version (0.4), there are a lot of bug fixes and new features :
- Added parsing of GNU LD scripts (issue #61)
- Fixed demangling of size_t / long C types with GCC
- Fixed Linux x86 symbols extraction
- Added experimental C++ virtual overrides : it is now possible to subclass C++ classes from Java, even with anonymous inner classes ! (no support for multiple inheritance yet)
- Fixed crash in C++ destructors at the JVM shutdown (issue #60)
- Fixed callbacks with float args
- Added support for varargs functions
- Introduced basic C++ templates support (binding of compiled template classes, not template methods / functions yet)
- Added dynamic functions support : Pointer.asDynamicFunction(callConv, returnType, argTypes…)
- Added support for arbitrary C++ constructors
- Added support for __stdcall callbacks
- Added COM VARIANT class with very basic data conversion support
- Added many COM UUID definitions (from uuids.h, codecapi.h, ksuuids.h)
- Added Solaris x86 support
- Added @DisableDirect annotation to force-disable raw assembly optimizations (also see BRIDJ_DIRECT=0 or -Dbridj.direct=false for global disable)
- Fixed long return values (issue #47)
- Fixed ‘@Ptr long’ return values on 32 bits platforms
- Fixed structs sub-structs and array fields
- Fixed unions :
- pure unions can be created with the @Union annotation on the union class (+ fields annotated with @Field(value = uniqueId))
- structs with unioned fields can be defined with fields annotated with @Field(value = uniqueId, unionWith = indexOfTheFirstFieldOfTheUnion)
- Fixed size computation of unions & structs (issue #51, issue #64)
- Fixed JAWTUtils on win32 (issue #52)
- Fixed Pointer.pointerToAddress(long, Class, Releaser) (issue #48)
- Fixed incomplete refactoring (issue #58)
- Moved all the is64Bits(), isWindows()… methods and SIZE_T_SIZE constants out of JNI class into new Platform class
- Moved the C++ symbols demanglers to package org.bridj.demangling
- Renamed Pointer.asPointerTo(Type) to Pointer.as(Type)
- Enhanced FlagSet (added toString(), toEnum(), fromValue(ValuedEnum))
- Enhanced Pointer (added allocate(Type), allocateArray(Type, long))
- Greatly enhanced the API Javadoc : stable version / development version
Many thanks to the early users and bug reporters (you can report bugs here).
Now what ?
- Download Bridj’s binaries : works on Windows (x86/x64), Linux (x86/x64), MacOS X (universal) and Solaris (x86)
- Generate BridJ wrappers for your library using JNAerator (just select “BridJ” in the “Runtime” combobox).
- Read some documentation :
- The FAQ might save your life
- BridJ API Javadoc :
- BridJ Development API (0.5-SNAPSHOT) (direct link : Pointer class)
- BridJ Stable API (0.4) (direct link : Pointer class) FYI Pointer is probably the most important class to look at, the only other classes you need to know about are the ones created by JNAerator.
- Join the NativeLibs4Java Google Group to share your questions and remarks with the community !