Article View: borland.public.jbuilder.java.language
Article #16613Re: JNI question. Need to talk to Bill Gates.
From: Will Dickson
Date: Mon, 01 Feb 1999 00:00
Date: Mon, 01 Feb 1999 00:00
49 lines
2399 bytes
2399 bytes
"Jason Burton" <Jason.Burton@McLeodSoftware.com> wrote:
>>Jason:
>>
>>Perhaps the dll you call has dependencies to other dlls? That's
>>another cause that springs to mind.
>>
>>-Rich
>
>
>I would think that the DLL uses the Windows system DLL's but it doesn't use
>anything else. I am able to access the DLL fine with other languages (i.e.
>the DLL is setup correctly on the machine I am using). My real question was
>am I forgetting something?
>
>In the class, I do
>
>static
>{
> System.loadLibrary("pcmgw32");
>}
>
>public native long PCMGCreateMapChild(long parentHandle);
>
>Assuming that the specified native function exists in the specified library,
>is that everything that must be done to access this function? The library
>seems to load fine, but calling the function gives the UnsatisfiedLink.
When you call a function from Java, the DLL routine that it actually
looks for a) is decorated (mangled) with the package/class details of
the calling class, and b) has very much its own set of calling
parameters - read the JNI specification for details, although one or
two bits require educated guesswork and experimentation since the
descriptions are rather terse.
I would think that you will have to create your own set of "wrapper"
fns in a new DLL of your own, which the JNI can relate to. These
wrappers then call the 3rd-party reoutine and relay back the results.
Be careful about calling conventions in Widows, and declare any fn you
want to call via JNI as extern "C" if you're working in (or your
compiler is working in) C++.
WIll Dickson.
>
>Thanks,
>Jason
>
Technical Details
Message-ID:
<36b6ec81.61423592@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<78gocb$p3j13@forums.borland.com> <36AC9D7D.55780D92@inprise.com> <78ibs1$qv59@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: wrd@glaurung.demon.co.uk (Will Dickson) Subject: Re: JNI question. Need to talk to Bill Gates. Date: 1999/02/01 Message-ID: <36b6ec81.61423592@news.demon.co.uk> X-Deja-AN: 439433808 Content-Transfer-Encoding: 7bit X-NNTP-Posting-Host: glaurung.demon.co.uk:158.152.178.66 References: <78gocb$p3j13@forums.borland.com> <36AC9D7D.55780D92@inprise.com> <78ibs1$qv59@forums.borland.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 917892573 nnrp-03:9352 NO-IDENT glaurung.demon.co.uk:158.152.178.66 MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language