Hi
actually SWIG does most of the job. It has these java-directors which
allow you to call back from C++ into java.
There is however still the problem of getting the initial reference
from C++ to a java object. But one could program
around that I think.
Regards
Mark Donszelmann
On Oct 30, 2009, at 5:39 PM, Mike Swingler wrote:
> On Oct 29, 2009, at 4:18 PM,
peastman@... wrote:
>
>> I'm interested in invoking Java code from native code.
>> Basically, I'd like to be able to take a Java library, and package
>> it up as a standard dynamic library that can be invoked directly
>> from other languages.
>> Of course I could do this manually: write a bunch of JNI code to
>> start up a VM, expose all the Java classes through a native API,
>> and forward all calls to the appropriate Java objects. But that
>> would be a lot of work, and it seems like the sort of thing that
>> could be automated.
>> There are plenty of tools to automate going the other way. JNA,
>> SWIG, etc. will take a native API and automatically package it up
>> so you can call it from Java. But I haven't found anything to let
>> you easily call Java from native code. Does such a tool exist?
>
> I've never heard of an automatic tool that will take a set of
> arbitrary Java classes and re-export them as C++ or Objective-C
> classes, but the JavaNativeFoundation.framework may be able to help
> you interface with Objective-C more easily. The documentation is at <
http://developer.apple.com/mac/library/navigation/index.html#section=Topics&topic=Cross%20Platform
> >, and the headers are at /System/Library/Frameworks/
> JavaVM.framework/Frameworks/JavaNativeFoundation.framework/Headers.
> The JNFJObjectWrapper may be of particular interest to you if you
> need to put JNI global refs into the reference counted Foundation
> containers.
>
> You'll still need to instantiate the JVM yourself using JNI_CreateJVM
> (), but once you have it going, it shouldn't be hard to poke into it
> using JNF or JNI.
>
> Regards,
> Mike Swingler
> Java Runtime Engineer
> Apple Inc. _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Java-dev mailing list (
Java-dev@...)
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/java-dev/mark.donszelmann%40gmail.com>
> This email sent to
mark.donszelmann@...
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user