digitalmars.D.learn - ImportC std support
- ManKey (2/2) Dec 11 2021 What implementations of the C standard library does importC
- forkit (3/5) Dec 11 2021 umm... the site has search function you know ;-)
- ManKey (7/9) Dec 11 2021 Dude, you see, it doesn't say anything about it. It says a little
- Steven Schveighoffer (11/12) Dec 13 2021 ImportC isn't really a way to import C. It's a C compiler built into the...
What implementations of the C standard library does importC support?
Dec 11 2021
On Saturday, 11 December 2021 at 21:42:49 UTC, ManKey wrote:What implementations of the C standard library does importC support?umm... the site has search function you know ;-) https://dlang.org/spec/importc.html
Dec 11 2021
On Saturday, 11 December 2021 at 22:28:16 UTC, forkit wrote:On Saturday, 11 December 2021 at 21:42:49 UTC, ManKey wrote: umm... the site has search function you know ;-)Dude, you see, it doesn't say anything about it. It says a little about the extension, but there is no direct answer. This is important because C Std is very dependent on the compiler and its extensions, for example msvc std c does not work with importC. So my question is, are there any implementations of the standard C library that importC supports?
Dec 11 2021
On Sunday, 12 December 2021 at 07:40:10 UTC, ManKey wrote:On Saturday, 11 December 2021 at 22:28:16 UTC, forkit wrote:ImportC is not ready for general use yet. I’ve been reporting bugs that crop up when trying to use standard c headers, but I mostly use Linux and Macs so I haven’t reported any constructs it doesn’t understand on Windows. It’s supposed to be able to compile standard C11 code. If you run into one, report it at https://issues.dlang.org and use the ImportC keyword!On Saturday, 11 December 2021 at 21:42:49 UTC, ManKey wrote: umm... the site has search function you know ;-)Dude, you see, it doesn't say anything about it. It says a little about the extension, but there is no direct answer. This is important because C Std is very dependent on the compiler and its extensions, for example msvc std c does not work with importC. So my question is, are there any implementations of the standard C library that importC supports?
Dec 12 2021
On Sunday, 12 December 2021 at 08:25:09 UTC, Dave P. wrote:ImportC is not ready for general use yet. ....I think you nailed it ;-) https://dlang.org/changelog/2.098.1.html
Dec 13 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
Dec 13 2021