Article View: borland.public.jbuilder.java.language
Article #692Re: Calling a dll func from Java
From: Chris Lafferty
Date: Mon, 28 Feb 2005 19:25
Date: Mon, 28 Feb 2005 19:25
44 lines
2962 bytes
2962 bytes
John (and everyone else that replied on this thread), That's what I was hoping and looking for. Thank you for the quick and precise responses. That helps a bunch. Thanks again, Chris "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:xn0dz152n3yyson005@newsgroups.borland.com... > 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:
<42236722$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!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> <xn0dz152n3yyson005@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 Reply-To: "Chris Lafferty" <clafferty2001@yahoo.com> From: "Chris Lafferty" <clafferty2001@yahoo.com> 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> <xn0dz152n3yyson005@newsgroups.borland.com> Subject: Re: Calling a dll func from Java Date: Mon, 28 Feb 2005 14:25:32 -0500 Lines: 46 Organization: B2B Technologies, Inc. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 216.64.94.24 Message-ID: <42236722$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109616418 216.64.94.24 (28 Feb 2005 10:46:58 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail