🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2516

Re: How can I access C++ dll from Java

#2516
From: Joi Ellis
Date: Tue, 03 Oct 2000 00:00
35 lines
1950 bytes
XAVIER COYRAS wrote:
> 
> I am trying to call from java a function contained in a  Dll written is C++.
> This function has an argument which type is PCHAR.
> I can't find the corresponding type in Java.
> 
> Function in the Dll is function_name(pchar param_name);
> 
> How can I access that function in Java?
> 
> I have tried
> - private static native void function_name(StringBuffer param_name);
> - private static native void function_name(String param_name);
> - private static native void function_name(Char[] param_name);
> 
> and none of them work.
> 
> Thanks

It's unlikely you'll ever be able to make such a call directly.
I think you need to investigate using JNI to build a glue layer that
will handle converting java's Unicode strings and characters into
the native platform's strings and thus into whatever pchar is.
You won't be able to do that without some extra C, as far as I know.

I'm doing similar things now with one of our own api libraries.

--
Joi Ellis                    Software Engineer
Aravox Technologies          joi@aravox.com, gyles19@visi.com

No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried.  Anything
that kicks a monopoly in the pants has got to be good for something.
           - Chris Johnson
Technical Details
Message-ID: <39DA1860.B431E250@aravox.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8rcma4$8je8@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,1f62b3b052d8a190
X-Google-Attributes: gid1089d0,public
From: Joi Ellis <joi@aravox.com>
Subject: Re: How can I access C++ dll from Java
Date: 2000/10/03
Message-ID: <39DA1860.B431E250@aravox.com>
X-Deja-AN: 677117291
Content-Transfer-Encoding: 7bit
References: <8rcma4$8je8@bornews.borland.com>
To: XAVIER COYRAS <fxcoyras@free.fr>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Aravox Technologies
Mime-Version: 1.0
Reply-To: joi@aravox.com
Newsgroups: borland.public.jbuilder.java.api