0

I've got the following swig file:

%module test

%ignore Stats;
%typemap(jstype)    Stats*  ""
%typemap(javain)    Stats*  "0"
 
void initialize(Stats* s);

I would like to suppress the 'Stats* s' parameter from the module class and just pass '0' to the JNI function

/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */


public class test {
  public static void initialize( s) { // How to supppress this parameter ?
    testJNI.initialize(0);
  }

}

I could not get rid of the parameter of the initialize method. Do you know what is the correct typemaps?

I read something about javaparams, but could not any documentation about it, and does not seems to work, or I do not use it correctly.

3
  • FYI, Java and C++ are two different languages with different syntax and semantic rules. For example, C++ doesn't have typemaps. I recommend remove the irrelevant language tags. Commented Nov 24 at 17:24
  • @ThomasMatthews typemaps are part of SWIG. Commented Nov 24 at 17:42
  • @ThomasMatthews IIRC, SWIG generates C "glue" code, so perhaps that would make the C tag applicable. (FWIW, I quit on SWIG a long time ago - it's harder to understand than just learning JNI or Python's ctypes, and in my actual experience it's a lot less reliable. Nevermind the generated code is rife with undefined behavior...) Commented Nov 24 at 17:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.