On 3/11/23 7:04 AM, bomat wrote:
Hi all,

I am a C++ programmer in my "day job" and was playing around with D to maybe use it in a personal project.

I'm using Dear ImGui for the graphical user interface, for which I use this port:
https://github.com/KytoDragon/imgui/

It works fairly well so far, just one problem: Dear ImGui is obviously `@nogc`, and I noticed that it doesn't mix with standard library functions. I tried `std.process.executeShell()` (which I'd kinda need for my project unless I want do do OS specific API calls), and `std.stdio.writeln()` (which I won't exactly be needing, just as a very basic test).

So my question is:
Is Phobos essentially incompatible to `@nogc`?
Or is there a trick for mixing GC code with non-GC code that I don't know?

Most of Phobos uses exceptions, which require the gc.


I'm assuming the second, for if the first was true I'd say that D would be pretty much useless when combined with non-D libs...

I think it is an error to mark a library which centers on callbacks with always being @nogc. You can work around nothrow and @safe, but not @nogc.

This also brings up a point that there just isn't a way to do a callback-centered library that can be simultaneously used with nogc or gc, unless you template based on that. It's not a good situation, and I don't know of a good solution.

-Steve

Reply via email to