D - D library "headers"
- brad beveridge (12/12) Dec 02 2003 Sorry if this has come up, or I've missed it somewhere.
- Julio César Carrascal Urquijo (5/17) Dec 02 2003 Have a look at the Synsoft libraries that Metthew Wilson created.
- Julio César Carrascal Urquijo (2/2) Dec 02 2003 Sorry, it should be Matthew Wilson and the SynSoft libraries are located...
- uwem (17/20) Dec 02 2003 No chance. I have a file 'types.d' with the following declaration:
- Sean L. Palmer (12/35) Dec 03 2003 You would have to provide a full class declaration, with forward-declare...
- Ilya Minkov (10/25) Dec 03 2003 It is enough to declare everything without extern, but you would leave
- Walter (7/10) Dec 26 2003 D is designed so that module imports can be implemented by loading some
- Sean L. Palmer (5/15) Dec 27 2003 If the original source file is smaller, you're probably right :)
Sorry if this has come up, or I've missed it somewhere. Lets for a moment assume that I want to write a library in D, compile it and distribute it as binary only. How would I go about letting other apps link to that library? So if I have void someFunc(void) in my library, could I distribute a D module that had extern (D) void someFunc(void); in it? Is it the same for classes. extern (D) class Foo;? Cheers Brad
Dec 02 2003
Have a look at the Synsoft libraries that Metthew Wilson created. You have to maintain two sets of .d files one with the implementation and another with just function declarations within a extern (D) {} block. "brad beveridge" <brad nospam.com> wrote in message news:bqisas$2t6q$1 digitaldaemon.com...Sorry if this has come up, or I've missed it somewhere. Lets for a moment assume that I want to write a library in D, compile it and distribute it as binary only. How would I go about letting other apps link to that library? So if I have void someFunc(void) in my library, could I distribute a D module that had extern (D) void someFunc(void); in it? Is it the same for classes. extern (D) class Foo;? Cheers Brad
Dec 02 2003
Sorry, it should be Matthew Wilson and the SynSoft libraries are located at http://synesis.com.au/synsoft/d.html.
Dec 02 2003
In article <bqjae4$ftv$1 digitaldaemon.com>, Julio César Carrascal Urquijo says...Have a look at the Synsoft libraries that Metthew Wilson created. You have to maintain two sets of .d files one with the implementation and another with just function declarations within a extern (D) {} block.No chance. I have a file 'types.d' with the following declaration: extern (D) { class test; } In a other source file 'myfunc.d': import types; void myfunc() { test xx = new test; } compile: dmd -c myfunc.d compiler says: types.d: class test is forward referenced Bye Uwe
Dec 02 2003
You would have to provide a full class declaration, with forward-declared member functions. You cannot instantiate forward-declared classes. It would be nice if the compiler would just go out and discover the class properties by looking at .obj file records, instead of having to parse it through a text file. But the point of these "headers" is to tell one how to use the library, and "module mylib; class foo;" doesn't tell you much about how mylib's foo objects work. Just knowing the class exists does not give you enough information to even construct an instance of the class, because you might need to provide parameters. Sean "uwem" <uwem_member pathlink.com> wrote in message news:bqjv5v$1f70$1 digitaldaemon.com...In article <bqjae4$ftv$1 digitaldaemon.com>, Julio César Carrascal Urquijo says...Have a look at the Synsoft libraries that Metthew Wilson created. You have to maintain two sets of .d files one with the implementation and another with just function declarations within a extern (D) {} block.No chance. I have a file 'types.d' with the following declaration: extern (D) { class test; } In a other source file 'myfunc.d': import types; void myfunc() { test xx = new test; } compile: dmd -c myfunc.d compiler says: types.d: class test is forward referenced Bye Uwe
Dec 03 2003
It is enough to declare everything without extern, but you would leave the code out, just as with C++. digc, the compiler driver which comes with dig library by Burton Radons (www.opend.org) can strip away function/method bodies. What you get is fairly equivalent to headers. In future, binary symbol tables might be implemented, which would solve the problem completely, but it is simply too early to think of such things right now... -eye brad beveridge wrote:Sorry if this has come up, or I've missed it somewhere. Lets for a moment assume that I want to write a library in D, compile it and distribute it as binary only. How would I go about letting other apps link to that library? So if I have void someFunc(void) in my library, could I distribute a D module that had extern (D) void someFunc(void); in it? Is it the same for classes. extern (D) class Foo;? Cheers Brad
Dec 03 2003
"Ilya Minkov" <minkov cs.tum.edu> wrote in message news:bqlev1$j5p$1 digitaldaemon.com...In future, binary symbol tables might be implemented, which would solve the problem completely, but it is simply too early to think of such things right now...D is designed so that module imports can be implemented by loading some vendor-defined precompiled symbol table binary file. I was going down the road implementing one such for DMD, until I realized that the lexer/parser is so fast that it made more sense to just parse the original source for the symbols.
Dec 26 2003
If the original source file is smaller, you're probably right :) Sean "Walter" <walter digitalmars.com> wrote in message news:bsgs2r$spd$1 digitaldaemon.com..."Ilya Minkov" <minkov cs.tum.edu> wrote in message news:bqlev1$j5p$1 digitaldaemon.com...theIn future, binary symbol tables might be implemented, which would solve the problem completely, but it is simply too early to think of such things right now...D is designed so that module imports can be implemented by loading some vendor-defined precompiled symbol table binary file. I was going down the road implementing one such for DMD, until I realized that the lexer/parser is so fast that it made more sense to just parse the original source forsymbols.
Dec 27 2003