Thanks from a python programmer
bachmeier
no at spam.net
Fri Mar 5 12:21:19 UTC 2021
On Friday, 5 March 2021 at 06:11:33 UTC, mipri wrote:
> This sets a C #define and then includes everything from stdio.h
> as a struct with #defines as variables, C functions as Zig
> functions, C #define *macros* also as Zig functions, etc. This
> time the magic is not from C codegen and deferring the work to
> a C compiler, but from Zig's compiler properly digesting C's
> header files.
*shrug* I work with C libraries all the time, and while dstep and
dpp might not handle everything, the parts they don't are minor.
> What D has is very fine, but it's general seating. Any language
> with an FFI at all should be about as capable as D's FFI.
As far as calling C functions? Of course, but those languages are
also as capable as Zig if all you want to do is call functions.
If you're talking about C interoperability more generally, you
have a strange definition of capable. You can create a D shared
library that can be called as if it's a shared C library. You can
go further and restrict yourself to betterC mode and then you're
basically writing modernized C code that without further
modification can be dumped in the middle of an existing C
project. I don't think, say, Ruby can do that even though it has
an FFI. Then there's the big issue of passing data back and
forth. That's a language design issue and D makes it easy.
More information about the Digitalmars-d
mailing list