Commit de82ed58 authored by Ilya Matiach's avatar Ilya Matiach Committed by Guolin Ke
Browse files

[SWIG] added typemap for string arrays in SWIG interface (#2118)

* added typemap for string arrays in SWIG interface

* added voidp pointer casts
parent c45ec4f1
......@@ -10,11 +10,18 @@
#include "../include/LightGBM/c_api.h"
%}
%include "various.i"
%include "carrays.i"
%include "cpointer.i"
/* Note: instead of using array_functions for string array we apply a typemap instead.
Future char** parameter names should be added to the typemap.
*/
%apply char **STRING_ARRAY { char **feature_names, char **out_strs }
/* header files */
%include "../include/LightGBM/export.h"
%include "../include/LightGBM/c_api.h"
%include "cpointer.i"
%include "carrays.i"
%typemap(in, numinputs=0) JNIEnv *jenv %{
$1 = jenv;
......@@ -199,14 +206,21 @@
%pointer_cast(int32_t *, int *, int32_t_to_int_ptr)
%pointer_cast(long *, int64_t *, long_to_int64_t_ptr)
%pointer_cast(double *, int64_t *, double_to_int64_t_ptr)
%pointer_cast(double *, void *, double_to_voidp_ptr)
%pointer_cast(int *, int32_t *, int_to_int32_t_ptr)
%pointer_cast(double *, void *, double_to_voidp_ptr)
%pointer_cast(float *, void *, float_to_voidp_ptr)
%pointer_cast(int *, void *, int_to_voidp_ptr)
%pointer_cast(int32_t *, void *, int32_t_to_voidp_ptr)
%pointer_cast(int64_t *, void *, int64_t_to_voidp_ptr)
%array_functions(double, doubleArray)
%array_functions(float, floatArray)
%array_functions(int, intArray)
%array_functions(long, longArray)
/* Note: there is a bug in the SWIG generated string arrays when creating
a new array with strings where the strings are prematurely deallocated
*/
%array_functions(char *, stringArray)
/* Custom pointer manipulation template */
......@@ -256,4 +270,3 @@ TYPE *NAME##_handle();
/* Allow retrieving handle to void** */
%pointer_handle(void*, voidpp)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment