Re: [Java] Function binding
Rene Rivera <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Organization | Redshift Software, Inc. |
| Message-ID | <[email protected]> |
John Moeller wrote: > The compile-time approach or something similar is necessary to generate > the native functions for a Java class; the arguments of the native > function have to be declared -- that is, there isn't a "blob" of Java > arguments that can be parsed at runtime. There are a couple of > alternatives that I've thought about, but they aren't very attractive > (at least to me). I had a long offline conversation with John about bindings, for context we worked together long ago to rewrite the Mac Common Lisp binding code, and we came up with a portable way of doing the Java bindings. Briefly... Langbinding provides a JNI class that manages in a generic way forwarding calls back and forth between the Java and C++ sides. When loading a C++ module, the Langbinding class reads the class descriptions from the C++ module and generates in memory bytecode for the Java side of those classes that just calls to the Lanbinding central class to package calls and forward through the Langbinging class. The Langbinding class loads the freshly generated bytecode classes into the JVM. The drawback to this approach is the additional translation layer, but perhaps this is a reasonable trade off given the extra flexibility gained. Now if someone could figure out how to generate bytecode to directly call C/C++ function pointers this extra layer could be removed. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo ------------------------------------------------------------------------- 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/