c++ - Is it possible to stop SWIG generating the module class for Java? -
i've created c++ class want able construct , call methods on java.
here (in file called test_swig_cpp_java.h):
#ifndef test_swig_cpp_java_h_ #define test_swig_cpp_java_h_ class goonjavaconstructme { public: void oohcomeoncallmeyouknowyouwantto(); }; #endif
i created module file swig (called test_swig_module.i) , put in it:
%module test; %ignore ""; %rename("%s") goonjavaconstructme; %rename("%s") goonjavaconstructme::oohcomeoncallmeyouknowyouwantto; %{ #include "test_swig_cpp_java.h" %} %include "test_swig_cpp_java.h"
i ran following command swig stuff:
swig -c++ -java test_swig_module.i
and listed files had in directory not 2 created - here list:
goonjavaconstructme.java test.java testjni.java test_swig_module_wrap.cxx
great, have cxx (test_swig_module_wrap.cxx
) file need compile in c++ code , on java side, class want call has been nicely created (goonjavaconstructme.java
) , can see jni declarations (testjni.java
) need compile in java gubbins.
seems ok far test.java
wonder ... when open it, looks this:
/* ---------------------------------------------------------------------------- * file automatically generated swig (http://www.swig.org). * version 3.0.2 * * not make changes file unless know doing--modify * swig interface file instead. * ----------------------------------------------------------------------------- */ public class test { }
an empty class same name swig module, interesting...so did research , see called module class , place global functions put.
right, fair enough, suppose gotta go somewhere thought, thing is, never have global functions being specific want expose single class , method java.
i could put step in build process deletes file after run swig, of course, idly wondered...
is possible stop swig generating module class java?
(there doesn't seem command line option far can tell figure answer no, maybe gurus on know of clever trick perhaps in module file)
Comments
Post a Comment