On Tuesday, 16 July 2013 at 14:15:55 UTC, Jacob Carlborg wrote:
Made a proof of concept to automatically parse, translate and import C header files in D using DStep. DMD is linked against DStep and does not start new process to make the translation.

I added a new pragma, include, that handles everything. Use like this:

// foo.h
void foo ();

// main.d

module main;

pragma(include, "foo.h");

void main ()
{
    foo();
}

DMD: https://github.com/jacob-carlborg/dmd/tree/dstep
DStep: https://github.com/jacob-carlborg/dstep/tree/c_api

This sounds pretty cool, and the suggestion from Timothee also makes a lot of sense.

Is there any way we can rig this to behave as if it were a CTFE invocation? It could be treated like an intrinsic up to the point where we have powerful-enough CTFE to replace it. I'm still not sure if Walter would be OK with this, but I figure I'd mention it, since it could give us something really nice without having to wait for CTFE to get good.

Reply via email to