Closed ahumenberger closed 4 years ago
I have the following C++ code which basically consists of the examples for enums and call operators:
#include "jlcxx/jlcxx.hpp" enum MyEnum { EnumValA, EnumValB }; template<> struct jlcxx::IsBits<MyEnum> : std::true_type {}; struct CallOperator { int operator()() const { return 43; } }; JLCXX_MODULE define_julia_module(jlcxx::Module& mod) { mod.add_bits<MyEnum>("MyEnum", jlcxx::julia_type("CppEnum")); mod.set_const("EnumValA", EnumValA); mod.set_const("EnumValB", EnumValB); mod.add_type<CallOperator>("CallOperator").method(&CallOperator::operator()); }
Then within Julia MyModule.EnumValA yields (Core.Compiler.UseRef(:((Core.getfield)(%11, 1)), 4), nothing).
MyModule.EnumValA
(Core.Compiler.UseRef(:((Core.getfield)(%11, 1)), 4), nothing)
However, when swapping the order, that is, doing add_type<CallOperator> before add_bits<MyEnum> then everything is fine.
add_type<CallOperator>
add_bits<MyEnum>
This might be related to #155.
I think this should be fixed on the master version, which should be released as v0.9 soon.
I have the following C++ code which basically consists of the examples for enums and call operators:
Then within Julia
MyModule.EnumValA
yields(Core.Compiler.UseRef(:((Core.getfield)(%11, 1)), 4), nothing)
.However, when swapping the order, that is, doing
add_type<CallOperator>
beforeadd_bits<MyEnum>
then everything is fine.