mardi 3 mars 2020

How to correctly SWIG c++ std::bitset to Java?

I am still studying SWIG with the goal of wrapping a complex C++ library in Java.

I have the following (stdbitset.h) class that holds a std::bitset<8>:

#include <bitset>
class Foo 
{ 
 public:
    std::bitset<8> myBitset;
};

that I use with this SWIG .i file

%module stdbitset
%{
 #include <bitset>
 #include "stdbitset.h"    
%}

%include "stdbitset.h"

SWIG then produces the expected output, wrapping the bitset to a class that holds the pointer: SWIGTYPE_p_std__bitsetT_8_t

What I want to achieve, if desirable (i.e. if there are no drawbacks), is to have the Java user test() for a value in the bitset.

Is this possible? How can I achieve this?

Thanks for your help

A.L.

Aucun commentaire:

Enregistrer un commentaire