Re: Java Binding

John Moeller <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
Rene Rivera wrote:
> John Moeller wrote:
>> OK, here goes.  I never did find out if this is still the proper place 
>> to submit stuff like this, so I'll assume it is.  I guess I'll give it a 
>> couple weeks and repost on devel if it doesn't get any traction here.
> 
> Yea, still the place for this :-)

Cool.  Thanks for replying so quickly.

> It's in the cards if you are willing to make it happen ;-)

Whew.  Ok, I have to admit that I'm a bit nervous now.  :)  This is a 
project that I think that I could definitely get behind; I'll give it my 
best shot.

> It's in the HEAD CVS under the "langbinding" branch. You can get the two 
> individual dirs for it:
> 
> http://boost.cvs.sourceforge.net/boost/boost/boost/langbinding/?pathrev=langbinding
> http://boost.cvs.sourceforge.net/boost/boost/libs/langbinding/?pathrev=langbinding

Aha.  Ok, I didn't notice the "show dead files" link.  Does that mean 
that they are still available to get through CVS?  I have to admit that 
it's been several years since I used CVS, and I wouldn't know how to 
retrieve them.  That is, I don't know what "dead" means in the CVS 
source browser.  Does that mean that they've been deleted from the 
repository, and these are the versions that existed before?  Would I 
just be retrieving a particular version of each file, or is there a tag 
that exists right before the files were killed?  Oh, and do I need 
access to CVS for this or is there anonymous access?

> It would. And I mentioned it as an idea long ago now. One of the big 
> problems with a Java binding is JNI itself. Since JNI works on link 
> symbol names it's still an open question of if it's possible to make it 
> work with arbitrary function pointers, or function objects.

Hrm.  Yeah, this may be the hardest part (aside from getting it to 
actually interface with Java).  What I ended up doing (for native-to- 
Java calls) in the toolkit I wrote was to create a system whereby the 
call was constructed from the arguments themselves.  I collected 
signature elements from the arguments as I got them in, and I generated 
the signature upon calling the function.  I don't know if this would be 
something that would fit the interface at all, but there may be 
something similar I could do.

I'd appreciate any function(al)-introspection ideas you have.

> There is interest. It's just not high enough priority.

That's good to hear, at least.

>> In fact, now that I think about it, there are methods to define a class 
>> file from a byte stream in ClassLoader (it's called defineClass, in 
>> fact).  You could maybe have a native method for a class that's always 
>> available, temporarily rebind it to an implementation defined in the 
>> module, and that module calls something that produces the byte array 
>> full of bytecode necessary for calling the class-definition method.  I'm 
>> probably getting way ahead of myself, though, and I don't even know if 
>> that would work.
> 
> Hm, interesting... The one other idea I had was to have the C++ side 
> generate dynamic symbols at load time. But that sounds way harder now 
> than doing a custom ClassLoader.

Oh, is this what you meant by a custom ClassLoader?  I was just thinking 
to use the base class; the functionality seems to exist in there.  I'm 
glad that this is along the lines of what you were thinking.

There's something scratching at the back of my mind about class loaders; 
I seem to remember something about needing to be consistent with them, 
like using the same one for loading different classes, something like 
that.  But I don't recall what that is.  I could just be crazy.

I agree with you about the difficulty of generating dynamic symbols at 
load time.  Especially now with the hoops that you want to jump through 
to generate code that works on Windows Vista.  Plus, it would be good to 
offer similar functionality for Linux/Solaris DSO's as well, and that 
increases the effort.

> Cool. Look forward to seeing the results.

I'll try to get started right away.  I've got work and home to juggle 
along with this too, but I'm excited to get going.

-- 

John Moeller
[email protected]


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.