Article View: borland.public.jbuilder.java.language
Article #691Re: Calling a dll func from Java
From: John McGrath [TeamB]
Date: Mon, 28 Feb 2005 09:55
Date: Mon, 28 Feb 2005 09:55
32 lines
2521 bytes
2521 bytes
On 2/26/2005 at 11:31:25 PM, Chris Lafferty wrote:
> I guess what I am confused about is 1) is the JNI C layer just an
> interface from Java to the DLL (when I ran javah, it created a function
> called Java_DLLBridge_RprtMain which I'm hoping is just a conduit from
> java to the DLL) or is 2) it actually asking for me to rewrite a function
> that already works in a DLL but with parameters that Java can communicate
> with. I'm guessing it's the 1st one, because it seems the second
> alternative would defeat the whole purpose of using a fully
> functioning/tested dll.
That is the signature of the C function that you need to write in order to
implement the RprtMain() method that you declared as "native" in your Java
DLLBridge class. Assuming you have an existing function in a DLL that you
are trying to call, you will typically just write this function to call
the other function. If the other function has parameters, you will
typically use JNI functions to get the parameter values and massage them
into the form required by that existing function, and do the reverse with
the function result.
Of course, there is no requirement that your native method call
pre-written C functions. You can implement your native method any way you
want to.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<xn0dz152n3yyson005@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<421eedd1$2@newsgroups.borland.com> <xn0dyx2iu419bb001-kdean@www.teamb.com> <421f8461$1@newsgroups.borland.com> <xn0dyxhy5p2f42000-kdean@www.teamb.com> <42214418$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a69aa8c14ff32559 X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: Calling a dll func from Java Newsgroups: borland.public.jbuilder.java.language References: <421eedd1$2@newsgroups.borland.com> <xn0dyx2iu419bb001-kdean@www.teamb.com> <421f8461$1@newsgroups.borland.com> <xn0dyxhy5p2f42000-kdean@www.teamb.com> <42214418$1@newsgroups.borland.com> User-Agent: XanaNews/1.17.2.7 Message-ID: <xn0dz152n3yyson005@newsgroups.borland.com> X-Ref: newsgroups.borland.com ~XNS:00000203 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 151.197.237.191 Date: 28 Feb 2005 01:55:29 -0800 X-Trace: newsgroups.borland.com 1109584529 151.197.237.191 (28 Feb 2005 01:55:29 -0800) Lines: 32 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail