digitalmars.D - Closed source D libraries
- "Henning Pohl" <henning still-hidden.de> Jul 15 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Jul 15 2012
- Benjamin Thaut <code benjamin-thaut.de> Jul 15 2012
- "Henning Pohl" <henning still-hidden.de> Jul 15 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Jul 15 2012
- "Henning Pohl" <henning still-hidden.de> Jul 15 2012
Most closed source C and C++ libraries provide headers and binaries. It seems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so.
Jul 15 2012
--f46d0401730b726fef04c4dd59ba Content-Type: text/plain; charset=UTF-8 On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <henning still-hidden.de>wrote:Most closed source C and C++ libraries provide headers and binaries. It seems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so.
It's quite possible. All you have to do is make a module, which doesn't contain any function bodies. The imported modules aren't compiled with the code. Most of the time it's easier to have a single module to have both the code to compile and symbols to import. In other cases they can be separated. -- Bye, Gor Gyolchanyan. --f46d0401730b726fef04c4dd59ba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <s= pan dir=3D"ltr"><<a href=3D"mailto:henning still-hidden.de" target=3D"_b= lank">henning still-hidden.de</a>></span> wrote:<br><blockquote class=3D= "gmail_quote" style=3D"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 see= ms to me that there is no way to do this in D, because the source files alw= ays have to be available to import their modules.<br> <br> I'm not going to write something proprietary or closed source, but i wo= nder if others can do so.<br> </blockquote></div><br>It's quite possible. All you have to do is make = a module, which doesn't contain any function bodies. The imported modul= es aren't compiled with the code. Most of the time it's easier to h= ave a single module to have both the code to compile and symbols to import.= In other cases they can be separated.<br clear=3D"all"> <div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br> --f46d0401730b726fef04c4dd59ba--
Jul 15 2012
Am 15.07.2012 15:06, schrieb Gor Gyolchanyan:On Sun, Jul 15, 2012 at 4:33 PM, Henning Pohl <henning still-hidden.de <mailto:henning still-hidden.de>> wrote: On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan wrote: On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <henning still-hidden.de <mailto:henning still-hidden.de>>__wrote: Most closed source C and C++ libraries provide headers and binaries. It seems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so. It's quite possible. All you have to do is make a module, which doesn't contain any function bodies. The imported modules aren't compiled with the code. Most of the time it's easier to have a single module to have both the code to compile and symbols to import. In other cases they can be separated. Okay, so it works just like in C: // The "header" file module lib; void printHelloWorld(); // The "source" file module lib import std.stdio; void printHelloWorld() { writeln("Hello world!"); } 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. -- Bye, Gor Gyolchanyan.
The compiler can even generate those files for using the -H option. It will generate .di files. Although any formatting will get lost during that process. Kind Regards Benjamin Thaut
Jul 15 2012
On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan wrote:On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <henning still-hidden.de>wrote:Most closed source C and C++ libraries provide headers and binaries. It seems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so.
It's quite possible. All you have to do is make a module, which doesn't contain any function bodies. The imported modules aren't compiled with the code. Most of the time it's easier to have a single module to have both the code to compile and symbols to import. In other cases they can be separated.
Okay, so it works just like in C: // The "header" file module lib; void printHelloWorld(); // The "source" file module lib import std.stdio; void printHelloWorld() { writeln("Hello world!"); }
Jul 15 2012
--f46d0407160b48af4904c4ddfabc Content-Type: text/plain; charset=UTF-8 On Sun, Jul 15, 2012 at 4:33 PM, Henning Pohl <henning still-hidden.de>wrote:On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan wrote:On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <henning still-hidden.de>** wrote: Most closed source C and C++ libraries provide headers and binaries. Itseems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so.
contain any function bodies. The imported modules aren't compiled with the code. Most of the time it's easier to have a single module to have both the code to compile and symbols to import. In other cases they can be separated.
Okay, so it works just like in C: // The "header" file module lib; void printHelloWorld(); // The "source" file module lib import std.stdio; void printHelloWorld() { writeln("Hello world!"); }
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. -- Bye, Gor Gyolchanyan. --f46d0407160b48af4904c4ddfabc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Sun, Jul 15, 2012 at 4:33 PM, Henning Pohl <s= pan dir=3D"ltr"><<a href=3D"mailto:henning still-hidden.de" target=3D"_b= lank">henning still-hidden.de</a>></span> wrote:<br><blockquote class=3D= "gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding= -left:1ex"> <div class=3D"im">On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan = wrote:<br> </div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l= eft:1px #ccc solid;padding-left:1ex"><div class=3D"im"> On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <<a href=3D"mailto:henning= still-hidden.de" target=3D"_blank">henning still-hidden.de</a>><u></u>w= rote:<br> <br> </div><div><div class=3D"h5"><blockquote class=3D"gmail_quote" style=3D"mar= gin: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=
<br> </blockquote> <br></div></div><div class=3D"im"> It's quite possible. All you have to do is make a module, which doesn&#= 39;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> =C2=A0 =C2=A0 =C2=A0writeln("Hello world!");<br> }<br> </blockquote></div><br>Exactly. Not defining a function body is perfectly f= ine for precisely these reasons. And, just like in C, forgetting to link wi= th the missing body will result in a linker error.<br clear=3D"all"><div> <br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br> --f46d0407160b48af4904c4ddfabc--
Jul 15 2012
On Sunday, 15 July 2012 at 13:26:19 UTC, Benjamin Thaut wrote:Am 15.07.2012 15:06, schrieb Gor Gyolchanyan:On Sun, Jul 15, 2012 at 4:33 PM, Henning Pohl <henning still-hidden.de <mailto:henning still-hidden.de>> wrote: On Sunday, 15 July 2012 at 12:21:23 UTC, Gor Gyolchanyan wrote: On Sun, Jul 15, 2012 at 4:05 PM, Henning Pohl <henning still-hidden.de <mailto:henning still-hidden.de>>__wrote: Most closed source C and C++ libraries provide headers and binaries. It seems to me that there is no way to do this in D, because the source files always have to be available to import their modules. I'm not going to write something proprietary or closed source, but i wonder if others can do so. It's quite possible. All you have to do is make a module, which doesn't contain any function bodies. The imported modules aren't compiled with the code. Most of the time it's easier to have a single module to have both the code to compile and symbols to import. In other cases they can be separated. Okay, so it works just like in C: // The "header" file module lib; void printHelloWorld(); // The "source" file module lib import std.stdio; void printHelloWorld() { writeln("Hello world!"); } 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. -- Bye, Gor Gyolchanyan.
The compiler can even generate those files for using the -H option. It will generate .di files. Although any formatting will get lost during that process. Kind Regards Benjamin Thaut
All right, thank you for the clarification.
Jul 15 2012









Benjamin Thaut <code benjamin-thaut.de> 