I have the following line of code inside the c.h file:
typedef struct ppr_my_struct* ppr_my_type;
I should mention that ppr_my_type is not defined in any of the .h files
I created a swigTest.i file that references a bunch of .h files (including the file noted above). An example is shown below:
%module swigTest
%{
#include "C:\blah\a.h"
#include "C:\blah\b.h"
#include "C:\blah\c.h"
%}
#include "C:\blah\a.h"
#include "C:\blah\b.h"
#include "C:\blah\c.h"
I ran swig to auto-generate the java files. The result of the "typedef struct ppr_my_struct* ppr_my_type;" is shown below:
public class SWIGTYPE_p_p_ppr_my_struct {
private long swigCPtr;
protected SWIGTYPE_p_p_ppr_my_struct(long cPtr, boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_p_ppr_my_struct() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_p_ppr_my_st开发者_JS百科ruct obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
My question is, how do I get a valid instance of SWIGTYPE_p_p_ppr_my_struct to use in my java code? If I do:
SWIGTYPE_p_p_ppr_my_struct blah = new SWIGTYPE_p_p_ppr_my_struct();
it throws a fatal exception when the object is used later in the code (presumably because I did not initialize it by calling the other constructor with which passes in a Pointer). No other methods in the remaining swig java files return an instance of SWIGTYPE_p_p_ppr_my_struct for me to use. What do I have to do in order to get a valid instance?
Thanks!
精彩评论