b***@yahoo.com
2017-01-17 15:27:59 UTC
Hi,
If I've a character array in my '.i' file, SWIG generates SWIG_strnlen() function in the wrapper file. However, this function is not qualified with 'SWIGINTERN'. Since this function is not marked static, when linking multiple modules together, this results in linker errors. Wouldn't it be better to mark SWIG_strnlen() static? I can see this issue in SWIG version 3.0.11.
Example:
$ cat test.i
%module test
char test_str[100];
$ swig -python test.i
$ egrep --before-context 2 SWIG_strnlen test_wrap.c
size_tSWIG_strnlen(const char* s, size_t maxlen)--Â Â Â {Â Â size_t size = SWIG_strnlen(test_str, 100);
We can see that other functions are marked as static inline:
$ egrep --before-context 2 SWIG_FromChar test_wrap.c
SWIGINTERNINLINE PyObject *SWIG_FromCharPtrAndSize(const char* carray, size_t size)--
Thanks,Balaji
If I've a character array in my '.i' file, SWIG generates SWIG_strnlen() function in the wrapper file. However, this function is not qualified with 'SWIGINTERN'. Since this function is not marked static, when linking multiple modules together, this results in linker errors. Wouldn't it be better to mark SWIG_strnlen() static? I can see this issue in SWIG version 3.0.11.
Example:
$ cat test.i
%module test
char test_str[100];
$ swig -python test.i
$ egrep --before-context 2 SWIG_strnlen test_wrap.c
size_tSWIG_strnlen(const char* s, size_t maxlen)--Â Â Â {Â Â size_t size = SWIG_strnlen(test_str, 100);
We can see that other functions are marked as static inline:
$ egrep --before-context 2 SWIG_FromChar test_wrap.c
SWIGINTERNINLINE PyObject *SWIG_FromCharPtrAndSize(const char* carray, size_t size)--
Thanks,Balaji