2 ms·
As for the amount of work required, we just rolled up our sleeves and did it :-) To improve interactivity with C, we even went so far as to build a C compiler
by WalterBright 5y ago
As for the amount of work required, we just rolled up our sleeves and did it :-)
To improve interactivity with C, we even went so far as to build a C compiler into the D compiler. It was officially released this week.
- lifthrasiir 5y agoIt seems that the C reimplementation is becoming a preferred approach for C FFI in recent languages---at least ones that can afford the cost. Not just D's ImportC but there are other examples like Python cffi. C++ FFI is another story though.
- melony 5y agoZig has C++ FFI
- lifthrasiir 5y agoZig's C and C++ FFI is basically based on embedding clang, which seems the only way for its level of FFI in case of C++. For C it is much more doable to make a new C compiler specifically for FFI.
- WalterBright 5y agoD's ImportC also allows the C code to be extended with D-ish features, like forward references, compile time function execution, and modules.