SWIGTYPE_p_p_ : a Pointer on a Pointer on a Structure ( From C/C++ to Java )

折月煮酒 提交于 2019-12-22 17:48:09

问题


I'm using Swig to generate Java classes.

I need to deal with a pointer on a pointer on a structure.

I have this structure :

struct Model {
    uint32_t serial;    
}

And I have a function in the C/C++ that needs to be wrapped :

void getModel( Model ** model ){
   // instructions...
}

I get as a result this Java class :

public class SWIGTYPE_p_p_Model {
  private long swigCPtr;

  protected SWIGTYPE_p_p_Model(long cPtr, boolean futureUse) {
    swigCPtr = cPtr;
  }

  protected SWIGTYPE_p_p_Model() {
    swigCPtr = 0;
  }

  protected static long getCPtr(SWIGTYPE_p_p_Model obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }
}

So my questions are :

  1. how can I use this class?

  2. How can I make a typemap in Swig to get read of SWIGTYPE_p_p ?

来源:https://stackoverflow.com/questions/21932242/swigtype-p-p-a-pointer-on-a-pointer-on-a-structure-from-c-c-to-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!