Closed lordzsolt closed 6 years ago
Based on the documentation, and based on #354, I had the impression that I should be able to generate constants with values.
However, with the following .djinni file
.djinni
Foo = interface +c { static version(): string; const major_version: i32 = 0; const minor_version: i32 = 1; const patch_version: i32 = 0; }
The following .hpp is generated:
.hpp
class PROJECT_EXPORT Foo { public: virtual ~Foo() {} static int32_t const MAJOR_VERSION; static int32_t const MINOR_VERSION; static int32_t const PATCH_VERSION; }
And I have to define the values in some implementation in order to not get linked error.
Looking at the code in #354, my understanding is this
constants_interface = interface +c { const i8_constant: i8 = 1; const i16_constant: i16 = 2; # i32_constant has documentation. const i32_constant: i32 = 3; }
is supposed to generate this
class ConstantsInterface { public: virtual ~ConstantsInterface() {} static constexpr int8_t I8_CONSTANT = 1; static constexpr int16_t I16_CONSTANT = 2; /** i32_constant has documentation. */ static constexpr int32_t I32_CONSTANT = 3; }
Any suggestions on what I might be missing?
Figured it out, we were using an internal version of Djinni 🤦♂️ cause "reasons".
Based on the documentation, and based on #354, I had the impression that I should be able to generate constants with values.
However, with the following
.djinni
fileThe following
.hpp
is generated:And I have to define the values in some implementation in order to not get linked error.
Looking at the code in #354, my understanding is this
is supposed to generate this
Any suggestions on what I might be missing?