看到这个,您将自己踢一下。您的SWIG界面的固定版本为:
%module TestModule%{#include "test.h"%}%include "std_string.i" // for std::string typemaps// Allow C++ exceptions to be handled in Java%typemap(throws, throws="java.io.IOException") CustomException { jclass excep = jenv->FindClass("java/io/IOException"); if (excep) jenv->ThrowNew(excep, $1.what()); return $null;}// Force the CustomException Java class to extend java.lang.Exception%typemap(javabase) CustomException "java.lang.Exception";// Override getMessage()%typemap(javapre) CustomException %{ public String getMessage() { return what(); }%}%include "test.h"即
%include "test.h"来 后,
你想申请到班test.h,而不是之前的typemaps。SWIG必须在首次看到它们适用的类时就已经看到它们。



