我在C:
中有一个enum
type.h
typedef enum{one, two, three=0x0}numbers;
work(numbers* param);
generate.i
%module swig
%{
#include "type.h"
%}
%include "type.h"
swig会生成wierd SWIGTYPE_p_numbers
类。如何使用它?如何在函数中将其作为参数传递?
编辑:
swig.java
public class swig {
public static void work(SWIGTYPE_p_numbers param){
swigJNI.work(SWIGTYPE_p_numbers.getCPtr(param));
}
}
SWIGTYPE_p_numbers.java
public class SWIGTYPE_p_numbers {
private long swigCPtr;
protected SWIGTYPE_p_numbers (long cPtr, boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_numbers () {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_numbers obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}