Precompiled libraries in D

Matthew Caron Matt.Caron at redlion.net
Wed Nov 21 06:34:34 PST 2012


On 11/21/2012 02:24 AM, Jacob Carlborg wrote:
> This is a fairly generic D question which would have fit better in the
> digitalmars.D newsgroup.

Ah. I will subscribe to it.

> But I'll answer it here anyway :)

Thank you very much.

> The precompiled-library-and-header paradigm can be used in D as well.
> It's just not that common. In D there is, what's called, D interface
> files (.di) in stead of header files. You can do any of
>
> * Just use the source together with a pre-compiled library (should
> probably be renamed to .di in that case)
> * Manually create di files
> * Automatically generate di files with the -H flag (I don't know if GDC
> uses the same flag for this)

Ah, thank you.

Now that I knew what I was looking for, I was able to find it in 
Alexandescu's book (though, in hindsight, the index item "header files" 
points you in the correct direction). For the archives, section 11.1.9 
Module Summaries starting on p 349 explains it well.

> Generating documentation from ddoc (similar to Doxygen) comments is
> preferred to do, but not many libraries do that. You can use the -D flag
> to do that, if the library do have ddoc comments.

Yeah, the issue with this (politically) is that the idea of providing a 
library + doxygen style output to customers makes many at my firm recoil 
in horror. Even though they see the value in doxygen docs, and we 
provide them to our customers, the lack of a .h file (or equivalent) is 
seen as making D unacceptable for real work. Now that I can point to .di 
files, the powers that be are happy - even if they are never used.

A small group of us are actually making a lot of headway in promoting D. 
Getting a working cross compiler built helped a lot, and its inclusion 
into mainline gcc will help even more, because it then would likely 
trickle into toolchains provided by chip vendors (since all they do 
these days is build gcc with all the options turned on). This all 
amounts to D being able to be a real, viable option for development.

(Note that our "embedded" systems are actually industrially ruggedized 
Linux machines, so we're not talking bare metal RTOS here. Hell, we run 
Perl in them.)

Thanks for the help.

-- 
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518) 877-5173 x138 office


More information about the D.gnu mailing list