On 05/02/2023 10:01 PM, Tamas wrote:
On the surface, betterC seems to be perfect for this case. How would YOU
do it (Adam, Richard)?
BtW, gstreamer also has D bindings, and maybe in the future I'll use
those. I suspect that Adam's suggestions have a stronger relevance to
that case, right?
So LDC with druntime and yes GC turned on is good enough right now that
you can probably make it work without too much effort. You don't
necessarily have to limit yourself to -betterC.
In fact if you don't, you have access to PyD[0] which can handle the
interop stuff for you. I haven't personally used it, but it might work
for your use case :)
The main thing is no matter what flags you pass, you'll need to be
careful about memory ownership between the language divide and the
ownership therein. You have already got a hang of that though from the C
version! Just gotta be extra careful with GC memory that its pinned on
the D side and won't get free'd elsewhere.
But yeah if you can avoid having to create bindings for stuff (such as
glib which we have bindings for), or wrappers ext. do so. That way you
can do more of the fun things!
[0] https://github.com/ariovistus/pyd