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 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
  • Enhanced FlagSet (added toString(), toEnum(), fromValue(ValuedEnum))
  • Enhanced Pointer (added allocate(Type), allocateArray(Type, long))
  • Greatly enhanced the API Javadoc : stable versiondevelopment version

Many thanks to the early users and bug reporters (you can report bugs here).

Now what ?

  1. Download Bridj’s binaries : works on Windows (x86/x64), Linux (x86/x64), MacOS X (universal) and Solaris (x86)
  2. Generate BridJ wrappers for your library using JNAerator (just select “BridJ” in the “Runtime” combobox).
  3. Read some documentation :
  4. Join the NativeLibs4Java Google Group to share your questions and remarks with the community !