Skip to content

Commit

Permalink
Fix SWIG methods that return char**.
Browse files Browse the repository at this point in the history
+ Add StringArray class to manage and manipulate arrays of fixed-length strings.

  This class is now used to wrap any char** parameters, manage memory and
  manipulate the strings.

+ Fix SWIG LGBM_BoosterGetEvalNames call that would result in a segfault.

  Added wrapper LGBM_BoosterGetEvalNamesSWIG (the method it wraps didn't work)

+ For consistency, LGBM_BoosterGetEvalNames was wrapped as well.

  Re-factored wrapper LGBM_BoosterGetEvalNames to follow LGBM_*
  convention of 0/-1 in case of success/failure.
  • Loading branch information
alberto.ferreira committed Mar 4, 2020
1 parent a373964 commit 8954897
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* them.
*
* It also implements working wrappers to:
* -
* - LGBM_BoosterGetFeatureNames (original hidden and replaced with a ...SWIG version).
*
* - LGBM_BoosterGetEvalNames (re-implemented with new API)
* - LGBM_BoosterGetFeatureNames (original non-wrapped version didn't work).
* where the wrappers names end with "SWIG".
*/

// Use SWIG's `various.i` to get a String[] directly in one call:
Expand Down
2 changes: 1 addition & 1 deletion swig/lightgbmlib.i
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ TYPE *NAME##_handle();
/* Allow retrieving handle to void** */
%pointer_handle(void*, voidpp)

%include "char_array_helpers.i"
%include "StringArray_API_extensions.i"

0 comments on commit 8954897

Please sign in to comment.