Re: Calling C++ from Java using CNI ?

David Daney <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Gareth Buxton wrote:
> Hi,
> I have been trying to find out how to call C++ code from Java using
> CNI. Is this at all possible?
>
> I found this page in the documentation which suggests a possible way:
>
> http://gcc.gnu.org/onlinedocs/gcj/Interfaces.html#Interfaces
>
> But I have been unable to make anything  work using this. Are there
> any code examples?
>
>   
libgcj is full of them.  You could try looking in libjava (the source to 
libgcj) for files named nat*.cc

find . -name nat\*.cc


For example, you could look at  java/io/File.java and 
java/io/natFilePosix.cc

I hope that helps.

David Daney
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.