Closed benmkw closed 3 years ago
Yes, It works for me in https://github.com/sonoro1234/LuaJIT-ImGui.
I dont know how your wrapping works. Perhaps you could ask to others having rust bindings to cimgui modules. (look for them in https://github.com/cimgui/cimgui: https://github.com/Gekkio/imgui-rs or https://github.com/4bb4/implot-rs)
But from a C perspective you should not wrap cimnodes.cpp (then you could wrap imnodes.cpp directly). Instead you should compile cimnodes.cpp (probably with cimgui.cpp and some backend also) and then wrap the generated module (.dll or .so) with the definitions found in cimnodes.h when you define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
But when you are building cimnodes.cpp you should not define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
and this is perhaps your error.
Yes you are right, got it compiling, thanks!
(that's my first time wrapping something using rust, or actually wrapping at all so..)
Sorry to reopen this.
I was wondering, why is the namespace defined as imnodes
when generating cimnodes.cpp, when in imnodes, it's defined as ImNodes
. If I change the namespace in imnodes.h to imnodes
, everything compiles okay, otherwise it's a compiler error.
So I feel like I might be missing something simple.
as done in https://github.com/sonoro1234/LuaJIT-ImGui/blob/docking_inter/CMakeLists.txt
this definition is necessary: add_definitions(-DIMNODES_NAMESPACE=imnodes)
for compilation because it is also used in the generation. (dont change imnodes.h for this)
The reason is to avoid colliding with the same namespace in https://github.com/rokups/ImNodes in case both are used at the same time. (as I do myself)
This was raised for the first time in https://github.com/Nelarius/imnodes/issues/97
I'm having the following issues when trying to wrap this api https://github.com/benmkw/imnodes-rs#todo where I'm not yet sure if its my fault (may very well be). Could you tell me if it works for you so that I can be sure its an issue on my side? :D