From: Rob M. <Rob...@ig...> - 2010-07-02 20:17:11
|
Great! Thank-you. William S Fulton wrote: > Rob Marshall wrote: >> Hi, >> >> Me again...I'm trying to add some Java code directly >> into a modules .java file, but if I do: >> >> %typemap(javacode) %{ >> code here >> %} >> >> I get a syntax error. If I use SWIGTYPE the code gets >> put into all of the Java files for each struct that >> is defined, but not in the module.java file, and if >> I use the module name, it doesn't go anywhere. Is there >> a way to get it into module.java? >> >> Just to hopefully be clear, if I have: >> >> %module my_module >> >> I want to be able to do: >> >> %typemap(javacode) not-sure-what-goes-here %{ >> java here >> %} >> >> And have the java code end up in my_module.java and >> not into any of the other generated .java files. I've >> read, and re-read, the documentation several times, >> but I still don't get it. >> > > Use the modulecode pragma, like: > > %pragma(java) modulecode=%{ > public static void addedFunction(String s) { > // Added function > } > %} > > similarly the jniclasscode pragma for the intermediary JNI class. > > William > |