I have a c++ project and using swig to build C# and Py bindings. Several of the methods I want to expose, now require them to accept a c++ enum eg MyEnum as an argument.
Say the enum is stored in myenum.h, how can I expose this via swig so that in eg c# I can use MyEnum.Value1 directly? I see that with no explicit definition of the enum, swig creates SWIGTYPE_p_MyEnum, but this only provides base swig methods, and the enum members are not present in the c# object.
Should this work out the box? I can bypass this by overloading the methods to accept int, and static_cast this on the c++ side but this somewhat defeats the purpose.
I have created the following .i file, myenum.i.
%module myenum%
{
#include "myenum.h"
%}
%include "myenum.h"
However this errors if I try to build. I have tried adding the path to myenum.h and the folder containing it via the -I flag when calling swig, however I either get the error:
No module name specified using %module or -module
or Must specify an input file.
. If I add myenum_i as a module name, I get this Unable to find file myenum.i
.