🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #447

Re: C++ pointers in JNI

#447
From: Kevin Dean [TeamB]
Date: Mon, 19 Sep 2005 04:19
32 lines
2331 bytes
Salvador Huertas wrote:

>I need use a C++ library with Java, I read de JNI documentation but, I 
>don't find anything about pointers. My question is: If I have a C++ rutine 
>with a parameter of type "double *par1" or "int *par2", what's java type 
>that must I use in the function's declaration within the java wrapper?.

I have no direct experience with JNI but you'll likely have to create some 
kind of proxy method and a wrapper class for the types you're passing by 
address.  For example:

public class DoubleWrapper {
   public double value;
}

You would then pass a DoubleWrapper object into a JNI function, which 
would then pass the address for the value to the C++ function you're truly 
interested in.  Class objects are passed by reference in Java whereas 
native types are passed by value.

-- 
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/

NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html

Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <xn0e7ey08jvma000-kdean@www.teamb.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <432d9259$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,51c1a3c9a21c424c
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kevin Dean [TeamB]" <NkOdSePaAnM@datadevelopment.com>
Subject: Re: C++ pointers in JNI
Newsgroups: borland.public.jbuilder.java.language
References:  <432d9259$1@newsgroups.borland.com>
Organization: Dolphin Data Development Ltd.
User-Agent: XanaNews/1.17.6.3
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobrp]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Message-ID: <xn0e7ey08jvma000-kdean@www.teamb.com>
X-Ref: newsgroups.borland.com ~XNS:00000318
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
NNTP-Posting-Host: 70.27.188.248
Date: 18 Sep 2005 21:19:51 -0700
X-Trace: newsgroups.borland.com 1127103591 70.27.188.248 (18 Sep 2005 21:19:51 -0700)
Lines: 32
X-Authenticated-User: kdean
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail