DMD 2.111.0 - Now with more ImportC!

Adam Wilson flyboynw at gmail.com
Thu Feb 27 07:18:54 UTC 2025


On Wednesday, 26 February 2025 at 12:17:17 UTC, Dejan Lekic wrote:
> Using ImportC _implies_ writing a "small tool" to make the 
> output somewhat useful. It will always be like that 
> unfortunately...

Not necessarily. If all you need is a quick import directly into 
the code, then ImportC works just fine. Sure the result has a bit 
of mess in it, but it's not like you have to see the mess, it's 
just there in the background.

But if you do want something cleaner, then you'd be writing a 
tool in any case, but with ImportC the tool ends up being far 
simpler because ImportC does all of the lexing, parsing, and AST 
transforms. All we have to do is trim the inputs down to what we 
actually want, you'd be doing that with other tools as well. And 
while the tool is used to work around bugs, this serves as a way 
to isolate and reduce bugs to a minimal test case, which makes it 
easier to fix the bug, then once the bug is fixed you simply 
delete the fix from the tool.

ImportC gives us options. If we need to quickly import something 
directly into the code ImportC supports that, even if what it 
generates is a little messy. But if you want to distribute 
bindings with your library, you write a simple tool that does the 
cleanups and runs ImportC. Either case has it's pro's and con's 
but both are supported. Nothing else can do that, which makes 
ImportC a superior tool.


More information about the Digitalmars-d mailing list