scala-native-bindgen icon indicating copy to clipboard operation
scala-native-bindgen copied to clipboard

Limited support for `const` qualifier

Open jonas opened this issue 7 years ago • 0 comments

Right now const is discarded, however, it should be possible to support its use in certain places, namely:

extern const int PI;
struct point { int x; int y; };
const struct point *get_cursor(void);
typedef bool (*visitor)(const struct point *point);

For variables (#70), the Scala definition should use val and for structs, one idea is to generate a separate type alias for const structs with an ops implicit class that does not contain the field_= methods. It would be nice to come up with an encoding that allows non-const structs to be assigned to a const version and disallow the inverse.

jonas avatar Jun 25 '18 15:06 jonas