🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.language
2 messages
2 total messages Started by Salvador Huertas Sun, 18 Sep 2005 16:15
C++ pointers in JNI
#446
Author: Salvador Huertas
Date: Sun, 18 Sep 2005 16:15
10 lines
1188 bytes
Hi friends,

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?.

Thanks in advance!!
Salvador Huertas.
 
Re: C++ pointers in JNI
#447
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads