Article View: borland.public.jbuilder.java.language
Article #16757Re: JNI question. Need to talk to Bill Gates.
From: jrevusky
Date: Wed, 27 Jan 1999 00:00
Date: Wed, 27 Jan 1999 00:00
39 lines
2435 bytes
2435 bytes
In article <78gocb$p3j13@forums.borland.com>, "Jason Burton" <Jason.Burton@McLeodSoftware.com> wrote: > I am curious how to implement some native methods contained in a 3rd party > DLL. I don't have a problem with my System.loadLibrary call, but when I go > to call one of the methods contained in the DLL, I get an > UnsatisfiedLinkException. I am sure that the function calls are in the DLL, > as I have done the same work in Delphi and C++, and I have capitalized the > function calls correctly (not sure if this matters or not in Java). Any > ideas why I get UnsatisfiedLink? I only see two possibilities. (1) You have mis-specified the function prototype that you need. Basically you need to run javah -jni <classname> to get the C-style header and then convert that to Delphi. (2) It can't find the DLL specified in the loadLibrary call. Well, probably (1) since you would probably have triple-checked (2) by now. > > Also, what do I need to do handle functions that take pointers as parameters > (or return them)? In general, you need to wrap your data as java objects and return a handle to it. IT gets complicated because the JNI is so messy in terms of instantiating java objects from native code and such. I have written an object-oriented API that is designed to wrap the whole JNI mess in a more intuitive manner. (At least it's fairly intuitive for me.) It's free. If you want to give it a try, follow the link in my sig below. Jonathan Revusky -- Java and Delphi Consulting Make your .class files double-clickable with SmartJ! http://www.bigfoot.com/~crystalline.solutions -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Technical Details
Message-ID:
<78nidn$9jv$1@nnrp1.dejanews.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<78gocb$p3j13@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,8780436ff7658d23 X-Google-Attributes: gidf74b3,public From: jrevusky@bigfoot.com Subject: Re: JNI question. Need to talk to Bill Gates. Date: 1999/01/27 Message-ID: <78nidn$9jv$1@nnrp1.dejanews.com> X-Deja-AN: 437491669 References: <78gocb$p3j13@forums.borland.com> To: Jason.Burton@McLeodSoftware.com X-Http-Proxy: 1.0 x3.dejanews.com:80 (Squid/1.1.22) for client 195.55.158.223 Organization: Crystalline Solutions X-Article-Creation-Date: Wed Jan 27 17:29:41 1999 GMT Newsgroups: borland.public.jbuilder.java.language X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I)