Description
Hello,
I'm having issues calling the SWIG wrappers in Java to extract the model feature names.
I get a segmentation fault when calling LGBM_BoosterGetFeatureNames.
In the Java-exposed lightgbmJNI.LGBM_BoosterGetFeatureNames method, the parameters are:
LGBM_BoosterGetFeatureNames(long boosterHandle, long outNumFeaturesPtr, String[] strings)
(https://lightgbm.readthedocs.io/en/latest/C-API.html#c.LGBM_BoosterGetFeatureNames)
The issue is that LGBM_BoosterGetFeatureNames requires an already allocated array of strings on the C side, which I cannot do if I pass a java String[] object. This then results in a memory segfault.
I've seen this comment related to implementing typemaps in SWIG for trickier cases #909 (comment).
I also saw some notices in the swig interface file:
/* 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)
Am I using the API incorrectly or currently this function cannot be used?
Thank you! :D