On 2012-11-20 22:58, Matthew Caron wrote:
Apologies if this is a "generic D" question, but I can't find an answer
in any of the D documentation, and folks on this list are quite helpful.

This is a fairly generic D question which would have fit better in the digitalmars.D newsgroup. But I'll answer it here anyway :)

The precompiled-library-and-header paradigm is very common in C. Is
there a similar one in D? I've used wxd, which is a port of wxWidgets to
D, and it builds a static .a library, which gets you half there, but
there is no equivalent header file that gets included - just the wx.d
file. Basically, if I'm linking against a D library, from where does the
user-readable documentation for that library come? Is it incumbent upon
the provider to provide Doxygen-style documentation?

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)

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.

(This came out of a lunchtime discussion at work - the statement was
made that "at least the C headers keep you honest. You can't use it
without something that a human can read". Not technically true, but the
point is well taken. While complete source code availability doesn't
matter for many cases (purely open source or purely internal
commercial), it does matter when you have a company writing a library to
be used by a client and they want a binary library + an API definition
exposed via a header file).

Thanks in advance.

See above.

--
/Jacob Carlborg

Reply via email to