Goal:
----------------------
- Make SWIG usefull for programs that can not
be compiled as a DLL/.so
- Avoid use of System.loadLibrary in Java Code
Idea:
----------------------
- Modify Source/Modules/java.cxx
- Generate an extra method that calls the JNI function
RegisterNatives() to register the native methods
associated with a class
- This method should get a pointer to an instantiated VM,
e.g. some_name(JavaVM *jvm);
I would be gratefull if the Java maintainer could
either implement this functionality or provide me with
some information on how to integrate that into SWIG
since I am not familiar with the SWIG code at all.
Thank you, Dennis
Logged In: YES
user_id=242951
If you could send me a working example of what you require
(what the generated code would do), I'll take a look at how
this could be implemented.
Logged In: YES
user_id=800216
We actually modified SWIG 1.3.29 to do this.
Goal
-------------
- Use a library which we only have in Java, from C++.
Implementation
---------------
- Mods to insert code to start JavaVM.
- Mods to java.cxx to handle call to registration of methods.
- Generation of calls for all classes to register their methods.
It is all a bit crude still, but does seem to work.
If there is a general interest by the SWIG team (Java) for
this, I would be happy to send in my changes.
Regards
Mark Donszelmann
I am interested in this feature -- can you please send the changes, so I can integrate these into most recent version of Swig on Github?
Thank You
Logged In: YES
user_id=933227
Originator: NO
I have written a Perl script to generate the registerNatives() code from the xxxJNI.java file, but I'd really prefer if such functionality would be built into SWIG itself.
In any case I'm willing to share the Perl script if there's interest.
Andras
Closing as a duplicate, since this is also in the github tracker:
https://github.com/swig/swig/issues/2034