简体   繁体   中英

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?

I have generated java interface class using swig from a c++ header file.

There is a problem that many C++ types were wrapped into class like this:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM