Writing closed source programs in D?

Regan Heath regan at netmail.co.nz
Fri May 31 05:06:13 PDT 2013


On Fri, 31 May 2013 12:25:48 +0100, Shriramana Sharma <samjnaa at gmail.com>  
wrote:

> Now I'm *not* going to write closed source programs in D [;-)], but am
> curious -- in C++ we have header files which a developer can
> confidently distribute along with the compiled libraries, and the
> actual source of the libraries (the *.cpp files) remains with the
> developer. In D, (obviously I'm a noob) it seems that module is the
> unit of programming, so how does one provide the library user with an
> API only without distributing the full D sources? Is it perhaps like
> Python where you can compile stuff into a SO and provide appropriate
> documentation so the user can just do import fooclosedlib and go
> ahead?

You ship the library with .di files created by the compiler.
http://dlang.org/dmd-linux.html#interface_files

.di files are .d files without the function bodies etc.  There are issues  
with templates and auto, but we will eventually have nice solutions for  
those.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list