From: William S F. <ws...@fu...> - 2009-06-16 22:18:33
|
Fasih Rehman wrote: > Hello All, > > I'm using SWIG to wrap a C++ API, and producing wrappers in Java. Now > I want to put a custom header on the generated C and Java files. So I > looked at the documentation and found %begin . Which for the generated > C code works great, I get our custom header below the standard SWIG > header which is fine. However I was expecting %begin to also do the > same with the Java classes. Can someone please clarify what the > correct behaviour of %begin is. Is it meant to only be in the > generated DLL code. > > I have tried moving the %begin declaration in my interface file, at > the moment it is in the %module section like it should be. > > %begin is only for the generated C/C++ wrap file. There isn't any straightforward way to put code at the top of the generated java files. You could hijack the javaimports typemap to put code almost at the top (after the package name), eg: %typemap(javaimports) SWIGTYPE "/* my stuff */" William |