swig
swig copied to clipboard
Default optional arguments do not work with JSCore and v8 generation
According to the docs, this is supposed to work for both C and C++ in a .i file: bool Init(int val=10);
The SWIG generation for JSCore and v8 fail to account for omitted arguments in this case, so in Javascript, calling mymodule.Init(); will fail because it doesn't have exactly 1 argument.
The generated code has this check: if(argc != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_Init.");
It needs to be more flexible to allow the default values to be assigned.