<div class="gmail_quote">On Sun, Jul 15, 2012 at 4:33 PM, Henning Pohl <span dir="ltr"><<a href="mailto:henning@still-hidden.de" target="_blank">henning@still-hidden.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <<a href="mailto:henning@still-hidden.de" target="_blank">henning@still-hidden.de</a>><u></u>wrote:<br>
<br>
</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Most closed source C and C++ libraries provide headers and binaries. It<br>
seems to me that there is no way to do this in D, because the source files<br>
always have to be available to import their modules.<br>
<br>
I'm not going to write something proprietary or closed source, but i<br>
wonder if others can do so.<br>
<br>
</blockquote>
<br></div></div><div class="im">
It's quite possible. All you have to do is make a module, which doesn't<br>
contain any function bodies. The imported modules aren't compiled with the<br>
code. Most of the time it's easier to have a single module to have both the<br>
code to compile and symbols to import. In other cases they can be separated.<br>
</div></blockquote>
<br>
Okay, so it works just like in C:<br>
<br>
// The "header" file<br>
module lib;<br>
<br>
void printHelloWorld();<br>
<br>
<br>
// The "source" file<br>
module lib<br>
import std.stdio;<br>
<br>
void printHelloWorld() {<br>
     writeln("Hello world!");<br>
}<br>
</blockquote></div><br>Exactly. Not defining a function body is perfectly fine for precisely these reasons. And, just like in C, forgetting to link with the missing body will result in a linker error.<br clear="all"><div>
<br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>