floooh / cimgui-sokol-starterkit

A minimal self-contained Dear ImGui starter project for Windows, Linux and macOS.
MIT License
212 stars 19 forks source link

Usage with Nim bindings #19

Open crystalthoughts opened 1 week ago

crystalthoughts commented 1 week ago

Hi, I have built cimgui as a library and I'm using your Nim bindings already - how would you recommend I use sokol_imgui.h with Nim?

floooh commented 1 week ago

Unfortunately I can't provide a simple solution.

sokol_imgui.h is currently only "officially" supported by the Zig and D bindings, mainly because the cimgui dependency doesn't make it as trivial to build into a static link library as with the other sokol headers (building sokol_imgui.h into a library requires to inject a header search path to the cimgui directory).

In the Zig and D bindings this is fixed through some special build system magic, but I haven't attempted to solve that problem in the other bindings yet,

crystalthoughts commented 1 week ago

Yeah I was running into this confusion as a novice to C linking and compilation- how to get it to find my static libraries. I assume even if I link my prebuilt libs, that header won't necessarily find them? I'm using Futhark to bind cimgui which takes care of a lot of the grunt work.

To get around it I've started just converting sokol-imgui by hand to Nim and calling my cimgui and sokol bindings directly. Do I still need the manual allocation parts, if I just make a fixed GC'd array in the parts where it uses the Pool?

I'd also be curious about your experience of D compared to Nim