Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Templates and Shared Libraries in D

I just realized something:

Nearly everything in D is becoming templated. That' awesome for a single executable, but how does that work with shared libraries? If no code is generated until it's compiled, then D can't make shared libraries that use templates, can it? (e.g. Phobos has to be static -- there's no other way, right?)

like image 940
user541686 Avatar asked Jul 12 '11 15:07

user541686


1 Answers

Well, it's the same issue like with C++ code.

Only the non-templated parts can be precompiled. Everything else must be provided with full source code.

Phobos being a shared or static library doesn't make much difference here. It's still static because of dmd's issues with shared libraries.

like image 99
Trass3r Avatar answered Oct 22 '22 07:10

Trass3r