ImportC + metaprogramming?

Steven Schveighoffer schveiguy at gmail.com
Sun Jan 16 16:38:11 UTC 2022


On 1/16/22 9:34 AM, max haughton wrote:
> On Sunday, 16 January 2022 at 08:13:37 UTC, Walter Bright wrote:
>> In this PR,
>>
>> https://github.com/dlang/druntime/pull/3670
>>
>> I added the ability for an ImportC file to import a D file. The 
>> initial purpose was so that core.stdc.stdarg could be imported to 
>> support variadics in C, without reimplementing them.
>>
>> I realized that this actually works - ImportC code can call D code! 
>> even use D templates!
>>
>> So then I got to thinking "what the hell have I unleashed?"
>>
>> I think I just destroyed dtoh.
> 
> So we inject this into all C files before compilation? Or modify all the 
> system headers?

The current expectation with ImportC is first you have to write a C file 
which imports what you want to convert, run it through the preprocessor, 
and then you compile it with D.

So it would go in that shim.

-Steve


More information about the Digitalmars-d mailing list