Swig using non constant declarations for size of typedeffed array

Viewed 68

I'm trying to wrap a C project with swig for Python. I have a .h file I'm including in swig with %include. I'd like everything in the header file to be wrapped.

Is there anything I can do to handle the below error, without having to edit the source header file.

test.h

#define SEPARATOR "-"
#define SEPARATOR_SIZE ((int)sizeof(SEPARATOR))
typedef char SEPARATOR_ARRAY [SEPARATOR_SIZE];

test.i

%module test
%{
  #include "test.h"
%}
%include test.h

After running swig -python test.i I get test.h:3: Error: Syntax error in input(1).

Using swig version 4.0.2.

1 Answers
Related