Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Using JNI from Managed C++

Thread Tools

Using JNI from Managed C++

Chris Uppal
Posts: n/a
FamilyNet International Newsgate

From: "Chris Uppal" <(E-Mail Removed)> Removed) wrote:

> Hey, I'm working with a Java Native Interface from managed C++

Boy! You're no fan of the simple life are you ?

I haven't done /anything/ with "managed C++", so take the rest of this with due

For a start, I wouldn't mess with the declarations the SUN provide -- they are
carefully designed to allow the JVM to access stuff at a lower level than
"portable C" (or C++). I.e. it knows about memory layouts and other such
stuff. So what I would do, as a first attempt, would be to write a bridge
component -- entirely in /real/ C++ (compiled to a normal, not .NET, DLL).
That component would do all the talking to JNI. I would then create a .NET
interface to that DLL, using the unmanaged C++ features.

A lot of work, and maybe not necessary, but I'd be rather surprised to find
that anything less complicated actually worked.

However, even that might not work. There is no guarantee that the Sun JVM and
the .NET equivalent will be happy sharing an address space. They both use very
low-level features of the OS (like setting guard pages, directly accessing the
processor stack, and so on) and might easily end up stepping on each other's

-- chris

FamilyNet <> Internet Gated Mail

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to memory managed by C module over JNI Sune Java 5 09-10-2007 02:37 AM
Using JNI from Managed C++ Java 2 07-30-2006 02:55 PM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
Porting JNI Windows under JNI LINUX + Wine ? Pasturel Jean-Louis Java 5 03-03-2004 07:50 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM