New in D

FinalEvilution FinalEvilution at gmail.com
Wed Jul 15 07:38:41 UTC 2026


On Wednesday, 15 July 2026 at 01:54:28 UTC, Jakepys wrote:
> While researching programming languages, I tried Zig, Rust, 
> C++, and Go, but none of them seemed fun. Then, at a 
> conference, I suddenly discovered D; I hadn't heard of it 
> before, and now I find it beautiful and very entertaining to 
> learn. I'm coming from C and I'd like to know what I can do 
> with it, especially regarding memory management and garbage 
> collection, although I don't think it's enabled by default. 
> Thanks.

Welcome!

This isn't related to memory management, but seeing as you're 
coming from C
you may find D's [ImportC](https://dlang.org/spec/importc.html) 
very interesting if you don't already know about it.
It allows for easy usage of C's library's in D. I'm using it for 
accessing the turbojpeg and dbus library's myself.

For example here's my jpeg.c file.

```C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "jpeglib.h"
```

And on the D side i just import it like so `import jpeg;`
Compile it with. `dmd main.d -L-ljpeg` No function declarations 
in it or the #include's so it doesn't even need to be added to 
the build command, just linked.
(I'm on linux building by hand with Make. If you're using DUB add 
[libs](https://dub.pm/dub-reference/build_settings/#libs) to the 
build file.)
And just like that i can access all the jpeg functions without 
any third-party wrappers.
It's pretty great.



More information about the Digitalmars-d-learn mailing list