digitalmars.D - Closed source D libraries
- Henning Pohl (6/6) Jul 15 2012 Most closed source C and C++ libraries provide headers and
- Gor Gyolchanyan (8/13) Jul 15 2012 It's quite possible. All you have to do is make a module, which doesn't
- Henning Pohl (11/31) Jul 15 2012 Okay, so it works just like in C:
- Gor Gyolchanyan (7/37) Jul 15 2012 Exactly. Not defining a function body is perfectly fine for precisely th...
- Benjamin Thaut (6/43) Jul 15 2012 The compiler can even generate those files for using the -H option. It
- Henning Pohl (2/72) Jul 15 2012 All right, thank you for the clarification.
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
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.
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: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!"); }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.
Jul 15 2012
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: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.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. ItOkay, 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!"); }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.
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 13:26:19 UTC, Benjamin Thaut wrote:Am 15.07.2012 15:06, schrieb Gor Gyolchanyan:All right, thank you for the clarification.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