Java bindings for libcapnp

178 views
Skip to first unread message

Charles Strahan

unread,
Dec 24, 2013, 11:22:53 PM12/24/13
to capnproto
Happy Holidays everyone,

A quick announcement: I have the beginnings of a JNI wrapper for the dynamic bits in libcapnp. I'm writing this library mostly for dynamic languages like JRuby and Jython, but I'll also write a compiler for Java and Scala that internally use the dynamic API. A pure implementation for Java and Scala would be ideal, of course, but this will hopefully be a provide a decent stopgap until then. I'll follow up with a link to the repo in just a bit.

Cheers,
-Charles

Kenton Varda

unread,
Dec 27, 2013, 3:24:24 AM12/27/13
to Charles Strahan, capnproto
Awesome!

Of course, bindings based on the dynamic API make less sense for a compiled language like Java compared to a fully-dynamic interpreted language like Ruby or Python.  But it works well as a stepping stone.  From there, we can optimize by exposing the underlying bytes directly as ByteBuffers and generating accessors based on those (while still relying on JNI bindings for I/O and RPC).

-Kenton


--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
Visit this group at http://groups.google.com/group/capnproto.

Chris Miller

unread,
Jan 9, 2014, 11:52:31 AM1/9/14
to capn...@googlegroups.com
Excellent news Charles, I'm looking forward to trying this out. I'm also willing to have a go at adding support for pure Java and sun.misc.Unsafe support as discussed previously on this list.

Out of interest, is your JNI support hand-coded or are you using a library like JavaCPP?

Charles Strahan

unread,
Jan 9, 2014, 2:24:36 PM1/9/14
to Chris Miller, capnproto
Excellent news Charles, I'm looking forward to trying this out. I'm also willing to have a go at adding support for pure Java and sun.misc.Unsafe support as discussed previously on this list.

Pure java support would be awesome!


Out of interest, is your JNI support hand-coded or are you using a library like JavaCPP?

The JNI support is hand-coded. That's in part because I don't have any experience with JavaCPP, and also because I feel a little more comfortable having full control. If someone down the road (maybe myself?) decides that JavaCPP would be easier to maintain, or less error prone, I wouldn't mind deprecating the current impl.

Speaking of my work on the bindings, I'm going to have a lot of free time here in a week, so there should some exciting updates soon.


--

Chris Miller

unread,
Jan 11, 2014, 8:28:53 AM1/11/14
to capn...@googlegroups.com, Chris Miller
On Thursday, 9 January 2014 19:24:36 UTC, Charles Strahan wrote:

Pure java support would be awesome!

Agreed :-)
 
The JNI support is hand-coded. That's in part because I don't have any experience with JavaCPP, and also because I feel a little more comfortable having full control. If someone down the road (maybe myself?) decides that JavaCPP would be easier to maintain, or less error prone, I wouldn't mind deprecating the current impl.

I was just curious really. I lean a little towards preferring hand-coded also but don't feel too strongly either way. JavaCPP is probably easier for non C++ developers (such as myself...) but as you hint at there's also the downsides associated with the additional abstraction, along with dealing with the library dependency.

Speaking of my work on the bindings, I'm going to have a lot of free time here in a week, so there should some exciting updates soon.

That sounds great. Give me a shout if you want a hand with any testing or whatever. In the meantime I'll see if I can make some progress on the pure Java side of things.

Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages