Import a public C enumeration from a C library into kotlin project

Viewed 27

We are working on a C library and trying to consume it on an Android kotlin project.
Everything works fine except for enum declared in the library itself.
It seems that cases defined are not available.
We had the same issue on Swift but we were able to takle it by conditional compiling the library and adding a specific attribute in the C code. Here a sample .h that once consumed by swift compiler can show the correct number of enum cases instead of just the uint32_t raw value.

#if defined (__APPLE__)
#include <CoreFoundation/CFAvailability.h>

typedef CF_ENUM(uint32_t, Cases) {
  case_zero         = 0,
  case_one          = 1
};
#else
typedef enum {
  case_zero         = 0,
  case_one          = 1
} Cases;
#endif

Is there any way to mark the enumeration to make it visible with all cases also on a kotlin(or maybe java) project without the need of rewriting a remapping?

0 Answers
Related