D as an extension language for C

jmh530 john.michael.hall at gmail.com
Mon May 15 12:20:29 UTC 2023


On Sunday, 14 May 2023 at 23:57:32 UTC, Walter Bright wrote:
> On 5/14/2023 4:39 PM, jmh530 wrote:
>> Is ImportC the final destination? Or is ImportC a step along 
>> the way to a final destination?
>
> Not sure what you mean. It is an end in itself.

You said before: "But D itself cannot read C .h files nor .c 
files (a capability that C++ has and has used to great advantage)"

importC lets you import .c file in D, but not a .h file. To 
import a .h file in D, I have to create a .c file and include 
only the .h file header and then import the .c file. Would you be 
able to streamline that further so that the .h file can be 
imported?

Maybe behind the scenes, it would look for a .d file, then a .c 
file, then try to create a blank .c file and include a .h? I 
don't know what makes the most sense, but think about it this 
way: for me to say some random C library works for D, I need to 
create a separate project for it with a .c file that includes the 
.h. If you can import the .h file directly, then it would just 
work (TM).


More information about the Digitalmars-d mailing list