0

I have an enum in C:

type.h

typedef enum{one, two, three=0x0}numbers;
work(numbers* param);

generate.i

%module swig
%{
#include "type.h"
%}
%include "type.h"

swig generates wierd SWIGTYPE_p_numbers class. How to use it? How to pass it as parameter in function?

EDIT:

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;
  }
}
Unheilig
  • 16,196
  • 193
  • 68
  • 98
Ignas J
  • 13
  • 7
  • java or c? you mentioned java but the code is c.. – Lucky Apr 14 '15 at 12:50
  • I added java classes generated by swig – Ignas J Apr 14 '15 at 13:04
  • some one else is talking about same question http://stackoverflow.com/questions/12856490/how-to-pass-a-value-to-a-function-when-the-value-is-swigtype – Ignas J Apr 14 '15 at 14:33
  • may be this could help http://stackoverflow.com/questions/11005123/how-do-i-convert-to-type-swigtype-p-void-in-swig-generated-java-bindings – Lucky Apr 14 '15 at 15:14

0 Answers0