I am trying to wrap my own C ++ library with swig, and I am stuck trying to convert time_t to C, to long in Java. I have successfully used swig with python, but so far I cannot get the above sample map to work in Java. In python, it looks like
%typemap(in) time_t { if (PyLong_Check($input)) $1 = (time_t) PyLong_AsLong($input); else if (PyInt_Check($input)) $1 = (time_t) PyInt_AsLong($input); else if (PyFloat_Check($input)) $1 = (time_t) PyFloat_AsDouble($input); else { PyErr_SetString(PyExc_TypeError,"Expected a large number"); return NULL; } } %typemap(out) time_t { $result = PyLong_FromLong((long)$1); }
I assume the map from Java to C will have:
%typemap(in) time_t { $1 = (time_t) $input; }
How can I complete a map display from C to Java?
%typemap(out) time_t ???
Do I need typemaps types like below?
%typemap(jni) %typemap(jtype) %typemap(jstype)
I need this to wrap C functions as follows:
time_t manipulate_time (time_t dt);
source share