ImportC std support

Steven Schveighoffer schveiguy at gmail.com
Mon Dec 13 20:33:23 UTC 2021


On 12/11/21 4:42 PM, ManKey wrote:
> What implementations of the C standard library does importC support?

ImportC isn't really a way to import C. It's a C compiler built into the 
D compiler. It only compiles C11 code *without* any headers (i.e. you 
can't use C standard library).

In order to properly import C headers, you have to first preprocess a C 
file (with a C preprocessor not supplied by D), and then use the output 
from that to build with your D project. And in that case, you likely 
will find it probably doesn't work yet, since it's not a ready feature.

I recommend instead just using D's hand-crafted bindings in `core.stdc` 
package, which do work.

-Steve


More information about the Digitalmars-d-learn mailing list