Re: JNI Woes
- From: Bill Medland <billmedland@xxxxxxx>
- Date: Mon, 30 Oct 2006 17:04:01 GMT
Gordon Beaton wrote:
On 30 Oct 2006 06:00:39 -0800, ShadowPhoenix wrote:
I am trying to call functions on the dll from Java, but all the things
I have read include running javah on the class file (which I can
successfully do), but it doesn't seem to help because I don't have
access to the source code, so I can't really use the header file.
Writing a wrapper library to implement the functions from the dll to
specifically work with Java (including jni.h, etc) is not at all
feasible because there are hundreds and hundreds of functions, and I
don't have enough time to write a library for them all.
Unfortunately for you, the technical reality of things doesn't care
how much time you've got, and Java does not offer any other technical
solutions. You can't invoke arbitrary C functions from a Java
application. The library must have been written to be used from Java,
wrapped suitably, or moved to a separate process that you communicate
with using other mechanisms.
Consider that using JNI doesn't necessarily mean that you need to wrap
your functions on a 1:1 basis. Choose a suitable place for your JNI
boundary, e.g. by moving it to a higher abstraction level you might
get a smaller contact area.
Or perhaps you don't really need all of those hundreds and hundreds of
functions. You only need to write wrappers for the stuff actually used
by your application.
There might also be some commercial products that can automate the
wrapping.
http://www.excelsior-usa.com/xfunction.html
might suite the OP's needs.
/gordon
--
Bill Medland
.
- References:
- JNI Woes
- From: ShadowPhoenix
- Re: JNI Woes
- From: Gordon Beaton
- JNI Woes
- Prev by Date: Undo Function in Java
- Next by Date: Problem in the Getting Index possition in JAVA
- Previous by thread: Re: JNI Woes
- Next by thread: looking JScrollPane method to default to bottom of list
- Index(es):
Relevant Pages
|