JavaCL 1.0.0-RC2 released : bugfixes, Maven Central repository

JavaCL v1.0.0 RC2 is available !

Download / Install | Browse JavaDoc | Getting Started (Tutorial) | Discuss

Launch the new JavaCL Interactive Image Transform Editor.

Release Notes

Here are the main changes between 1.0.0-RC1 and 1.0.0-RC2 (see full change log) :

  • Release artifacts are available in Maven Central
  • Added support for sub-images reading/writing from/to CLImage2D (slower than with full images)
  • Fixed endianness issues with CLBuffer (issue #80)
  • Fixed migration of cached binaries to newer versions of OS (e.g. upgrading from Snow Leopard to Lion) (issue #81)
  • Fixed handling compiler options containing spaces (issue #274)
  • Fixed tutorial artifact pom repositories (issue #279)
  • Fixed support of Intel’s OpenCL 1.5 Windows runtime (issue #297)
  • Fixed many Javadoc typos
  • Enhanced LocalSize API (added static factory methods for all primitive types)
  • Deprecated CLContext.getKernelsDefaultByteOrder() and CLDevice.getKernelsDefaultByteOrder()
  • Added more informative exceptions when passing null pointers to CLBuffer.writeBytes (issue #257)
  • Updated to OpenCL 1.2 headers
  • Added -cl-nv-verbose, -cl-nv-maxrregcount, -cl-nv-opt-level + proper log even without error when nv-verbose is set
  • Enhanced handling of endianness : warn when creating contexts with devices that have mismatching endianness, throw when creating buffer out of Buffer / Pointer with bad endianness
  • Changed signature of CLPlatform.listDevices (now takes a single CLDevice.Type, including All, instead of an EnumSet thereof)

Getting started

You can read the Getting Started (Tutorial) page on the wiki to get started very quickly !

Please join the NativeLibs4Java Google Group to discuss JavaCL / ScalaCL, get the latest news and ask for support from the growing JavaCL community.

Posted in Uncategorized | Comments Off

JNAerator 0.10 released : bugfixes, added Maven project output modes

JNAerator (licensed under LGPL 3.0) lets Java programmers access native libraries transparently, using a runtime such as BridJ (C / C++, BSD-license), JNA (C only, LGPL) or Rococoa (Objective-C).

This new release contains tons of critical fixes, so all JNAerator users are strongly encouraged to migrate to this new version.

Here’s a summary of the changes between version 0.6 and 0.6.1 (see full change log here) :

  • Fixed generation of large long values
  • Fixed conditional parsing of __in modifier (and COM modifiers in general)
  • Fixed generation of globals and variables included more than once
  • Fixed parsing of unary ‘-’ operator
  • Fixed parsing of C++ constructors and class inheritance
  • Fixed parsing of default values for type name template arguments
  • Fixed parsing of const type mutator (fixes `void f(struct x * const);`) (issue #205)
  • Fixed parsing of null char escape ‘\0′ (issue #214)
  • Fixed conversion of `int a; f(&a);`
  • Fixed handling of “long int” and “short int” (issue #267)
  • Fixed parsing of __declspec, __attribute__ and some modifiers-related regressions
  • Fixed conversion of __inline functions when -convertBodies is on
  • Fixed NPE in JNAeratorUtils.findBestPlainStorageName (issue #258)
  • Fixed parsing of empty strings (spotted by @ENargit in issue #255)
  • Fixed generation of typedefs (issue #273)
  • Fixed generation of casted constants (issue #96)
  • Fixed generation of unnamed structs and unions (issue #94)
  • Fixed multidimensional array sizes for JNA target (issue #165)
  • Fixed handling of hexadecimal constants (issue #296)
  • Fixed conversion of comments for BridJ target runtime
  • Fixed generation of BridJ calling conventions (issue #282)
  • Fixed handling of __stdcall function pointers and functions (issue #282)
  • Fixed mapping of bool for JNA(erator) target runtime (issue #289)
  • Fixed parsing of malloc, free and many potential modifiers (issue #278 and issue #280)
  • Fixed handling of unicode library paths (issue #276)
  • Fixed parsing of friend members in C++ classes, and of assignment operators (operator+=, …)
  • Fixed generation of very simple edge cases “long f();”, “short f();”, “f();” (issue #270)
  • Changed naming of anonymous function pointer types : `void f(void (*arg)());` now yields callback `f_arg_callback`
  • Enhanced handling of parsing failures : faster failover to “sliced” parsing, reduced verbosity of errors
  • Added Maven output modes and -mode switch to choose between Jar, StandaloneJar, Directory, Maven, AutoGeneratedMaven (deprecated -noJar and -noComp)
  • Added support for MSVC asm soups + added -removeInlineAsm hack switch that tries to regex-remove __asm soups that still cannot be parsed out
  • Added support for BridJ’s bundled libraries mechanism and paths (+ enforce them using an enum param)
  • Added parsing of expression initializer blocks `v = { 1, 2, 3};`
  • Added preservation of original textual representation of constants
  • Added tr1 to default C++ includes
  • Generate symbols of all files in directories where any file was explicitly listed
  • Added support for command-line definition of macros with arguments : -Df(x)=whatever
  • Added conversion of `malloc(x * y * sizeof(whatever))`
  • Removed C++ name mangling feature for JNA target runtime (was simplistic anyway)
  • Release artifacts are available in Maven Central

Special thanks to the users and bug reporters that helped getting this version out !

You can contribute to the project by reporting bugs here and joining the NativeLibs4Java Community.

Wait no longer : try JNAerator through Java Web Start, or download it now !

Posted in Uncategorized | Comments Off

BridJ 0.6.1 released : bugfixes, Maven Central, better performance

BridJ (BSD-licensed) 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).

Here’s a summary of the changes between version 0.6 and this bugfix-release version 0.6.1 (see full change log here) :

  • Release artifacts are available in Maven Central
  • Fixed wchar_t and WideCString on MacOS X (issue #295)
  • Fixed @Name annotation
  • Fixed deletion of temporary extracted library files with shutdown hook (issue #197)
  • Fixed Unix binaries dependency on GLIBC 2.11 (lowered to version 2.2.5) (issue #195)
  • Fixed some pointer methods : 3D pointers allocation, Pointer.setXXXsAtOffset, float endianness conversion
  • Fixed regression on struct-valued struct fields (when implemented by java fields) (issue #200)
  • Fixed crash with valued enum return values (issue #196)
  • Fixed crash of dynamic callbacks on Win32
  • Fixed attachment of native threads in native -> Java callbacks (should attach them as JVM daemon threads)
  • Fixed C++ inner class name-mangling matching
  • Fixed signature of ITaskbarList3.SetProgressValue (issue #218)
  • Fixed Pointer.getByteBuffer() and Pointer.getBytes() (and all their type variants !)
  • Fixed StructIO.getEnumField (now returns an IntValuedEnum<E>)
  • Fixed handling of CLong / SizeT java fields in structs (cf. issue #253)
  • Fixed StructIO.FieldDecl accessibility to allow override of all StructIO.Customizer methods (cf. issue #220)
  • Fixed regression on libc, created with null path (issue #217)
  • Fixed back-references in Visual C++ demangler (issue #291)
  • Fixed binding of IntValuedEnum<E> types
  • Fixed handling of virtual destructors with GCC-compiled libraries (and virtual table pointer + runtime guess / check of virtual index for virtual methods) (issue #281)
  • Fixed shortcuts in GCC4Demangler (contrib from Rémi Émonet, issue #211)
  • Added support for PointerIO<IntValuedEnum<E>> (issue #261)
  • Added ProcessUtils.getCurrentProcessId()
  • Allow libname.so and name.so for embedded libraries on Unix (issue #215)
  • Enhanced multi-threaded performance of PointerIO.getInstance (issue #203)
  • Added Pointer.getXxxs(XxxBuffer)
  • Added alias mechanism for annotations : any annotation which class is itself annotated by @Ptr / @CLong can serve as an alias (issue #202)
  • Added native error log when LoadLibrary or dlopen failed
  • Added IntValuedEnum<E> FlagSet.fromValue(int, E…)
  • Enabled all compiler optimizations on all platforms but win32
  • Updated doc of Pointer.getXxxs()
  • Added experimental by-value struct support on amd64 for structs larger than 64 bits (disabled by default, set -Dbridj.structsByValue=true or BRIDJ_STRUCTS_BY_VALUE=1 to enable)

Special thanks to the users, contributors and bug reporters that helped getting this version out !

You can contribute to the project by reporting bugs here and joining the NativeLibs4Java Community.

Wait no longer : download and use BridJ now !

Posted in Uncategorized | Comments Off

January Update : JNAerator, BridJ, JavaCL, ScalaCL and… Scalaxy !

Happy New Year !

First, I’d like to thank all the users of JNAerator, BridJ, JavaCL and ScalaCL for their continued support and help.

The progress over this year wouldn’t have been possible without the contributions of Rémi Émonet (biggest patcher), Kazó Csaba (who even created javaclpp) and Atsushi Eno (Android support).

I’d also like to give a special thank to some of the most prolific and friendliest bug-reporters of this year : Andrei Sochirca, Raphael Cohn, Andrea Aime (but there are so many others !).

Now here are some news about the projects, for those who don’t follow the commits on github :-)

Maven Central

I’m in the process of getting all NativeLibs4Java artifacts on the Maven Central repository (using Sonatype OSS). What this means is that you won’t need to add repository and/or pluginRepository tags to your Maven project files to get the releases, and that the snapshots will now be available from Sonatype’s OSS Snapshots Repository (see updated usage instructions).

There are still a few blocking points (like, deploying Android’s dex tool to Maven Central), but I’m optimistic about finishing this task in the next few weeks.

In the meanwhile, should you want to build from sources or even just depend on a snapshot version, you might need to install dx to your local repository manually using the script BridJ/admin/android-dx-package.

BridJ

I’ll be releasing version 0.6.1 of BridJ with tons of fixes as soon as the Maven Central work is completed.

Please note that passing or returning structs by value will still not be supported in that release, although some experimental work has been shoved in (for very large structs on select platforms).

For more details please see BridJ’s CHANGELOG.

JNAerator

This year I’ve been criminally lazy with JNAerator release notes : I haven’t announced versions 0.9.8 and 0.9.9 publicly… maybe because I wasn’t that proud of the stability of these two versions :-S

Anyway, 2012 should be much better since the upcoming version 0.9.10 is bound to become the best version of JNAerator ever, with a few quantum leaps in features and stability (will release it in within a few weeks).

For more details please see JNAerator’s CHANGELOG.

Oh, and please note a big change here : JNAerator artifact’s groupId was changed to com.nativelibs4java (was previously com.jnaerator), and snapshots are available on Sonatype’s OSS Snapshots Repository.

JavaCL

Version 1.0-RC2 of JavaCL will ship soon, with quite a few bug fixes.

For more details please see JavaCL’s CHANGELOG.

Oh, and last but not least : JavaCL is now covered in the chapter of OpenCL in Action (clearly the best OpenCL reference and hands-on guide out there, packed with amazing real-world examples !)

ScalaCL vs. Scalaxy

Since last summer’s Scalathon, progress on ScalaCL hasn’t been very visible because it’s been a bit slow : the new stream rewrite pipeline broke all the tests (especially those that compare the compiled bytecode to some reference hand-rewritten version), so it’s become hard and unrewarding to work on the project. But now the tests are almost back to normal, and it’s time to split the project in two parts :

  • Scalaxy Compiler Plugin for generalistic loop rewrites, performance warnings and compile-time coding guidelines enforcement
  • ScalaCL Collections & Compiler Plugin for GPGPU computation (the plugin obviously depends on Scalaxy since it needs to rewrite loops found in Scala functions converted to OpenCL kernels)

If you have any idea of a better name for Scalaxy, please contribute it on the list or on twitter : previous codename was FaSca (for Faster Scala), but I’m not sure I like the new one much more :-S

It’s hard to say when a release will be ready for either ScalaCL or Scalaxy, since the latter still requires quite a bit of stabilization, but snapshots should already be usable right now.

That’s it for today, happy hacking to everyone !

Posted in BridJ, In English, JavaCL, JNAerator, NativeLibs4Java, ScalaCL, Uncategorized | Comments Off

BridJ 0.6 released : new protected mode, more stable (especially on Windows), Objective-C delegates & blocks

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).

Here’s a summary of the changes between version 0.5 and this new version 0.6 (see full change log here) :

  • Added errno/GetLastError() mechanism : declare methods to throw org.bridj.LastError and it’s all handled automatically (issue #74)
  • Added protected mode (-Dbridj.protected=true / BRIDJ_PROTECTED=1), to prevent native crashes (makes BridJ bindings slower + disables optimized raw calls).
  • Added proxy-based Objective-C delegates support (forwards unknown methods to a Java instance) (issue #188)
  • Added Objective-C 2.0 blocks support (similar to callbacks, inherit from ObjCBlock instead of Callback) (issue #192)
  • Added Pointer.asList() and .asList(ListType) to get a List view of the pointed memory
    • depending on the ListType, the view can be mutable / resizeable
    • removed the List interface from Pointer (which is now just an Iterable)
    • added Pointer.allocateList(type, capacity) to create a NativeList from scratch (has a .getPointer method to grab the resulting memory at the end)
  • Added Pointer.moveBytesTo(Pointer)
  • Added support for embedded libraries extraction from “lib/arch” paths (along with “org/bridj/lib/arch”, where arch uses BridJ’s convention)
  • Added TimeT (time_t), timeval classes (issue #72)
  • Added Platform.getMachine() (same result as `uname -m`)
  • Added support for multiarch Linux distributions (issue #2)
  • Added support for versioned library file names (issue #72)
  • Added global allocated memory alignment setting (BRIDJ_DEFAULT_ALIGNMENT env. var. & bridj.defaultAlignment property), + Pointer.allocateAlignedArray
  • Added basic calls log mechanism (disables direct mode) : -Dbridj.logCalls=true or BRIDJ_LOG_CALLS=1 (only logs the method name & signature, not the arguments or returned values)
  • Added BridJ.setMinLogLevel(Level) (issue #190)
  • Added Platform.addEmbeddedLibraryResourceRoot(root) to use & customize the embedded library extraction feature in user projects
  • Added support for packed structs (@Struct(pack = 1), or any other pack value)
  • Added check of BridJ environment variables and Java properties : if any BRIDJ_* env. var. or bridj.* property does not exist, it will log warnings + full list of valid options
  • Added @JNIBound annotation to mark native methods that should not be bound by BridJ but by plain old JNI
  • Fixed Pointer.next/.offset methods (used to throw errors a the end of iteration)
  • Fixed Pointer.getNativeObjectAtOffset(long byteOffset, Type type)
  • Fixed struct fields implemented as Java fields
  • Fixed resolution of MacOS X “ApplicationServices” framework binaries, such as CoreGraphics
  • Fixed some COM bugs with IUnknown
  • Fixed demangling/matching of CLong & SizeT
  • Fixed CLong & SizeT arguments
  • Fixed Objective-C runtime (basic features), added NSString constructor & NSDictionary (with conversion to/from Map&lt;NSString, NSObject&gt;)
  • Fixed crashes on Win32 (when using Pointer class in bound function arguments)
  • Fixed crash during deallocation of Callbacks + fixed leak of Callbacks (now need to retain a reference to callbacks or use BridJ.protectFromGC / unprotectFromGC)
  • Made the StructIO customization mechanism more flexible
  • Made JawtLibrary public
  • Various Javadoc tweaks

Special thanks to the users, contributors and bug reporters that helped getting this version out !

You can contribute to the project by reporting bugs here and joining the NativeLibs4Java Community.

Wait no longer : download and use BridJ now !

Posted in Uncategorized | Comments Off

JavaCL 1.0.0-RC1 released : switched to BridJ, added FFT utils and UJMP matrices, bugfixes, API updates…

JavaCL v1.0.0 RC1 is available !

Feedback needed : last-minute bugs will be fixed in next release candidates within the coming weeks, then a final 1.0 version will be released.

Download / Install | Browse JavaDoc | Getting Started (Tutorial) | Discuss

Launch the new JavaCL Interactive Image Transform Editor.

Release Notes

Here are the main changes from this new version (see full change log) :

  • The BridJ-powered version now becomes the default !
    The JNA version is still maintained and available with all Maven artifact ids suffixed with “-jna”. See migration notes below…
  • Added simple Fourier-analysis classes (package com.nativelibs4java.opencl.util.fft), with double and float variants, usable with primitive arrays or OpenCL buffers :
  • Added some math-related compiler options to CLProgram :
    • setFastRelaxedMath() (triggers all the others !)
    • setFiniteMathOnly()
    • setUnsafeMathOptimizations()
    • setMadEnable()
    • setNoSignedZero()
  • Added CLContext.createBuffer(Usage, Buffer)
  • Added CLBuffer.copyTo(CLQueue, CLMem destination, CLEvent…) and CLBuffer.emptyClone(Usage)
  • Added NIOUtils.indirectBuffer(size, bufferClass)
  • Added CLContext.toString
  • Deprecated CLXXXBuffer in favor of CLBuffer<xxx> (CLIntBuffer becomes CLBuffer<Integer>, etc…)
  • Changed CLContext.createBuffer(Usage, length, class) to createBuffer(Usage, class, length) to match the JavaCL/BridJ API (and provoke migration issues : people should now use a primitive class rather than an NIO buffer class !!!
  • Complete rewrite of UJMP Matrix implementation, using a design borrowed to ScalaCL (uses the BridJ port of JavaCL)
  • Fixed issue #66 (create temp files in ~/.javacl subdirectories instead of /tmp)
  • Fixed OpenGL sharing on MacOS X
  • Fixed CLProgram.getBinaries() in some cases
  • Fixed CLBuffer.read on indirect buffers
  • Fixed NPE that happens with null varargs CLEvent[] array
  • Fixed length = 1 case in reduction utility
  • Fixed ATI detection (“ATI Stream” now replaced by “AMD Accelerated Parallel Processing”, cf. Csaba’s comment in issue #39)
  • Fixed issue #55 : applied Kazo Csaba’s patch to fix the bounds of CLBuffer.map’s returned buffer
  • Fixed inheritance of CLBuildException (now derives from CLException)

Migration notes : from JNA to BridJ

The “javacl” Maven artifact now refers to the BridJ version of JavaCL, while “javacl-jna” corresponds to the JNA version (which was the default version up to 1.0 beta 6).

While the JNA version is still maintained (and will get patches at least for the 1.0.x versions), it is advised that all users migrate to the BridJ port at some point. The main selling points are :

  • Smaller call overhead (BridJ beats out JNA in interop. performance)
  • BSD-licensed (as opposed to the LGPL license of the JNA version)
  • Nicer API, with generic CLBuffer<T> instead of typed buffer classes (CLIntBuffer is now CLBuffer<Integer>)
  • All the new features will be reserved to the BridJ version

This quick migration guide on the wiki will help you perform the move in minutes.

Getting started

You can read the Getting Started (Tutorial) page on the wiki to get started very quickly !

Please join the NativeLibs4Java Google Group to discuss JavaCL / ScalaCL, get the latest news and ask for support from the growing JavaCL community.

Posted in Uncategorized | Comments Off

BridJ 0.5 released : Android support, dynamic callbacks, prepackaged subsets, support for old Java and MacOS X versions…

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).

Here’s a summary of the changes between version 0.4.1 and this new version 0.5 (see full change log here) :

  • Added support for the Android / arm platform (issue #69)
  • Added Pointer.clone() that duplicates the pointed memory (requires a pointer with bounds information)
  • Added various pre-packaged specialized subsets of BridJ : c-only, windows-only, macosx-only, unix-only, linux-only, ios-only, android (see details on the wiki)
  • Added Pointer.allocateDynamicCallback(DynamicCallback, callingConv, returnType, paramTypes…)
  • Added BridJ native library path override : one can set the BRIDJ_LIBRARY environment variable or the “bridj.library” property to the full path of libbridj.so/.dylib/.dll
  • Fixed behaviour in environments with a null default classloader (as in Scala 2.9.0)
  • Added support for Java 1.5 (issue #57)
  • Added support for MacOS X 10.4, 10.5 (was previously restricted to 10.6)

Special thanks to Atsushi Eno, whose testing and many patch proposals were instrumental in getting BridJ to work on Android.

By the way : anyone can contribute to the project by reporting bugs here.

Wait no longer : download and use BridJ and join the NativeLibs4Java Community !

Posted in Uncategorized | Comments Off

BridJ 0.4.1 released (r1990): many callbacks fixes, better windows APIs support, enhanced C++ templates…

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).

Here are the changes since version 0.4 (see full change log here) :

  • Fixed callbacks on Windows x86
  • Fixed multithreaded callbacks ! (callbacks called in a different thread than the one that created them used to hang indefinitely)
  • Fixed Pointer and ValuedEnum arguments and return values in callbacks
  • Fixed loading of libraries that depend on other libraries in the same directory on Windows (issue #65)
  • Fixed BridJ.sizeOf(Pointer.class), sizeOf(SizeT.class), sizeOf(CLong.class)…
  • Enhanced C++ templates support
  • Added support for Windows APIs Unicode vs. ANSI functions renaming (e.g. SendMessage being one of SendMessageW or SendMessageA, depending on Platform.useUnicodeVersionOfWindowsAPIs)
  • Added deprecated support for struct fields implemented as Java fields, to ease up migration from JNA (needs manual calls to BridJ.writeToNative(struct) and BridJ.readFromNative(struct)) (issue #54)
  • Added preliminary read-only support for STL’s std::vector C++ type
  • Added BridJ.describe(Type) to describe structs layouts (automatically logged for each struct type when BRIDJ_DEBUG=1 or -Dbridj.debug=true)
  • Added BridJ.describe(NativeObject).
  • Added StructObject.toString() (calls BridJ.describe(this))
  • Added BRIDJ_DEBUG_POINTERS=1 (or -Dbridj.debug.pointers=true) to display extended pointer allocation / deallocation debug information
  • Reorganized Windows COM packages (moved out DirectX code to it own top-level project : com.nativelibs4java:directx4java)
  • Implemented FlagSet.equals

Special thanks to Andrei Sochirca for this release : couldn’t have made it without his patient and tireless testing and bugs reporting.

Anyone can contribute to the project by reporting 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. 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.

  5. Join the NativeLibs4Java Google Group to share your questions and remarks with the community !
Posted in Uncategorized | 1 Comment

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 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. 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.

  5. Join the NativeLibs4Java Google Group to share your questions and remarks with the community !
Posted in Uncategorized | 1 Comment

JNAerator 0.9.7 released (r1817, 20110329) : better pointer types, better BridJ generation and C++ parsing

More than ever, JNAerator lets Java programmers access native libraries transparently, using a runtime such as BridJ (C / C++), JNA (C only) or Rococoa (Objective-C).

As version 0.9.6 was a kind of silent release (not advertised), here are the main changes since version 0.9.5 :

  • Fixed generation of typed pointers (+ introduced undefined types for BridJ runtime)
  • Added generation of globals for BridJ
  • Added -parseInOneChunk option to control parsing more finely (forces regular, non isolated-mode parsing, which is more correct but also more fragile)
  • Fixed issue 82 (enum renaming)
  • Fixed issue 79 (unescaped quotes in string defines)
  • Fixed issue 84 (some exotic function pointer syntax)
  • Fixed binding of Windows’ BOOL type for BridJ: it’s int, not boolean !!!
  • Added explicit call to setFieldOrder in JNAerated JNA structures (not needed with BridJ, which has its @Field annotations to guarantee proper order)
  • Enhanced parsing and AST generation of C/C++ expressions
  • Fixed BridJ inherited struct fields indexes computation

As usual, there’s more than one way to use JNAerator :

Many thanks to the bug reporters ! (you can help too : join the NativeLibs4Java Google Group)

Posted in Uncategorized | Comments Off