Wrapping enum for python containing uint64_t
Nils Carlson via Swig-user <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAMLe_OTKPiPFLYBRPJtU5-cn78X7xqFu6AaU1FsDROQh9kimGA@mail.gmail.com> |
Hi,
I'm very much stuck on wrapping an enum consisting of uint64_t values for
python. I end up with generated values which are ints - but they need to be
longs.
The code looks like this (simplified for testing obviously):
enum.h
---------------
#include <cstdint>
class HelloWorld
{
public:
enum Enum : uint64_t
{
A_ENUM = 0x8000000000000000,
B_ENUM = 0x4000000000000000
};
Enum m_e;
};
--------------
And a trivial interface file:
interface.i
-----------------
%module interface
%{
#include "enum.h"
%}
%include "enum.h"
-----------
When compiling and running up python I get the following, which is quite
obvious as we are truncating long values down to int:
-----------
>>> import interface
>>> interface.HelloWorld.A_ENUM
0
------------
Any and all help is much appreciated. I found examples for getting this
working in c#, but nothing for python and I'm quite lost.
Cheers,
Nils Carlson
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user