Search code examples
dstatic-linking

How to link to D Libraries in a D program


I´m new to the D Programming Language and have a very simple problem.

I want to compile a D Script Library once and then use it in my other D projects.

In C I linked to the .lib files and created headers for them, but in D I don´t find things like that (are there even some sort of headers in D?)

I use D-IDE as my IDE and DMD2 as my compiler.


Solution

  • there are .di (D interface) files which can be used as header these can be generated from your sources with the -H compiler switch

    however the libraries I've seen will just have the source files to import

    you can use the -I switch to specify where the compiler will look for imports

    and the -L switch will be passed to the linker