Article View: borland.public.jbuilder.java.api
Article #3374Re: Calling Delphi DLL's
From: cliff
Date: Wed, 14 Jan 1998 00:00
Date: Wed, 14 Jan 1998 00:00
101 lines
3200 bytes
3200 bytes
This approach to calling Delphi DLL's worked well. Thanks for the advice.
The programmer that wrote the Delphi port for the javah to javapas routine did a really fine
job.
Paul, thanks for your help.
Cliff
Paul Whittington wrote:
> - First go get the Port of Netscape Plugin / LiveConnect SDK V30b5 to
> Delphi 2,3 at
>
> http://www.geocities.com/SiliconValley/Pines/7004/DLPEPAGE.HTM
>
> - Second write and compile a Java class that looks something like this
>
> public class HelloNative
> {
> public native static void greeting();
>
> static
> {
> System.loadLibrary ("HelloNative");
> }
> }
>
> that declares a native method, in this case greeting, and provides static
> initialization code that will load the DLL using System.loadLibrary.
>
> - Third follow the directions on how to run javapas and run it against the
> .class file you just created.
>
> - Forth add a procedure in the generated code that looks something like
> this
>
> procedure native_HelloNative_greeting(_EE_: PJRIEnv; p:pointer);
> begin
> writeln('Hello, Native World!');
> end;
>
> that implements the native method.
>
> - Fifth build a Delphi DLL by using code that looks something like
>
> library HelloNative;
>
> uses
> SysUtils,
> Classes,
> Jri in '..\Jri.pas',
> Jri_md in '..\Jri_md.pas',
> Jritypes in '..\Jritypes.pas',
> UHelloNative in '..\UHelloNative.pas';
>
> exports
> Java_HelloNative_greeting_stub;
>
> begin
> end.
>
> - Sixth build a Java main program that calls the native method that looks
> something like this
>
> public class HelloNativeTest
> {
> public static void main (String[] args)
> {
> HelloNative.greeting ();
> }
> }
>
> - Finally run the main program.
>
> TTFN Paul
>
> cliff wrote:
>
> > Does anyone have an example of how to call a Delphi DLL or ActiveX from
> > Jbuilder?
> > Any help would be appreciated.
> >
> > Cliff
>
> ------------------------------------------------------------------------
>
> Paul Whittington <paul@sage.inel.gov>
> Advisory Engineer
> Idaho National Engineering and Environmental Laboratory
>
> Paul Whittington
> Advisory Engineer <paul@sage.inel.gov>
> Idaho National Engineering and Environmental Laboratory HTML Mail
> Netscape Conference Address
> Netscape Conference DLS Server
> Additional Information:
> Last Name Whittington
> First Name Paul
> Version 2.1
Technical Details
Message-ID:
<34BD4773.B692E005@erols.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34BABBE2.AAFA3EB6@erols.com> <34BBCE95.BC85D180@sage.inel.gov>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,f7978574be57d5a5 X-Google-Attributes: gid1089d0,public From: cliff <hickmanc@erols.com> Subject: Re: Calling Delphi DLL's Date: 1998/01/14 Message-ID: <34BD4773.B692E005@erols.com> X-Deja-AN: 316002197 Content-Transfer-Encoding: 7bit References: <34BABBE2.AAFA3EB6@erols.com> <34BBCE95.BC85D180@sage.inel.gov> Content-Type: text/plain; charset=us-ascii Organization: Object Makers and co. Mime-Version: 1.0 Reply-To: hickmanc@erols.com Newsgroups: borland.public.jbuilder.java.api