On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:

Should be able to just use it, as described here: https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and then call the functions you need.

Wow. **That just worked the first time!** Holy &^@$ that's easy!

So why does the 2nd page returned from the google search
```
interfacing with C site:dlang.org
```
(which happens to be: https://dlang.org/spec/interfaceToC.html) still have this text:

Since D can call C code directly, it can also call any C library functions, giving D access to the smorgasbord of existing C libraries. To do so, however, one needs to write a D interface (.di) file, which is a translation of the C .h
header file for the C library into D.

For popular C libraries, the first place to look for the corresponding D interface file is the Deimos Project. If it isn't there already, please write and contribute
one to the Deimos Project.
?

This lead me to believe that interfacing was a chore and I was considering going back to C for a small program I need.

@D Language Foundation - This is a HUGE selling point. I had to use cups the other day and I just copied some code from a d file and linked the library. It was so easy I was suspicious but it worked. Using C from D is pretty much as easy as using C from C and I think you should advertise that better!

Reply via email to