[英]how can I set a value of SWIGTYPE like SWIGTYPE_p_LPCSTR using java
how can I set a value of SWIGTYPE like SWIGTYPE_p_LPCSTR using java? 如何使用Java设置SWIGTYPE的值(如SWIGTYPE_p_LPCSTR)?
I have generated java interface class using swig from a c++ header file. 我已经使用C ++头文件中的Swig生成了Java接口类。
There is a problem that many C++ types were wrapped into class like this: 有一个问题,许多C ++类型被包装到这样的类中:
public class SWIGTYPE_p_LPCSTR {
private transient long swigCPtr;
protected SWIGTYPE_p_LPCSTR(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_LPCSTR() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_LPCSTR obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
Actually, I just want it to be a simple type like string or int.I guess this is a pointer, but don't know how to use it? 实际上,我只希望它是一个简单的类型,例如字符串或整数。我猜这是一个指针,但不知道如何使用它?
These are opaque classes. 这些是不透明的类。 You don't really use them, they are just passed around.
您并没有真正使用它们,它们只是被传递出去了。 Please see the SWIG 3.0 Documentation
请参阅SWIG 3.0文档
My guess of what's happening here is that your header has a LPCSTR which is a macro possibly defined in another header (probably as char*) and SWIG doesn't know what the macro expands to so instead of using its typemap for strings it wraps the LPCSTR into this proxy class. 我对这里发生的情况的猜测是,您的标头有一个LPCSTR,这是一个可能在另一个标头中定义的宏(可能是char *),而SWIG不知道该宏会扩展为什么,因此它不使用其类型映射表来封装字符串。 LPCSTR进入此代理类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.