× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



It is exceedingly likely that you will have to create some "glue" code to
invoke any existing DLL.  This may seem odd and frustrating, but this is
pretty normal.  Existing DLLs were designed before Java even existed, after
all, and Java's interface is intended to be largely platform independent
(that is, readily adapt, but still adapt to the underlying platform's
conventions for C as opposed to providing them directly).

Don't forget, for instance, that a String is a real object and not a
character array.  If your interfaces passes in a String, you'll have to use
the APIs provided in jni.h to fetch the two byte Unicode characters and
then, most likely, translate them to the appropriate Windows single byte
character set (such as MS 1252).  Even if you do that before calling the
JNI code, you'll still have an array of bytes which, in Java, is still a
first class object and not a simple array of characters.

If your defined interface happens to consist entirely of integers (and I
don't mean Integer but scalar integers), and returns nothing or an integer,
then the glue code will be very simple.  However, it will very likely still
have to be provided.  I've never even considered not having the glue code
in any JNI I ever wrote.  I'm not sure, for instance, of the consequences
of trying to do the "load" or "loadlib" command on a regular DLL as opposed
to one created using Java's conventions.  You need instead to have your own
DLL that can be loaded by the Java Virtual Machine.



Larry W. Loen  -   Senior Linux, Java, and iSeries Performance Analyst
                          Dept HP4, Rochester MN




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.