D - using modules
- C (7/7) Mar 16 2004 It took me a day to figure out that to use modules I had to specify the ...
- J C Calvarese (9/17) Mar 16 2004 That is a common mistake. I know I've done that. I think people have
- Phill (16/23) Mar 17 2004 files in
- Matthew (6/28) Mar 17 2004 before
- Andrew Edwards (30/42) Mar 17 2004 With #include the entire content of the file specified between < and >
- C (15/60) Mar 18 2004 Hmm good thought , you could use Carlos' (or Lars ? sorry I forget ) =
- Carlos Santander B. (5/10) Mar 18 2004 Not mine: Lars'. However, digc can do that exactly. Maybe you'll want to...
It took me a day to figure out that to use modules I had to specify the files in the compile command. I just misunderstood the way the import keyword worked. I thought it was like #include and the compiler would chain the files before it compiled. Maybe I'm just stupid, but shouldn't that be documented somewhere? I would have no problem with doing it myself, but how do I get it published on the D site? C
Mar 16 2004
C wrote:It took me a day to figure out that to use modules I had to specify the files in the compile command. I just misunderstood the way the import keyword worked. I thought it was like #include and the compiler would chain the files before it compiled. Maybe I'm just stupid, but shouldn't that be documented somewhere? I would have no problem with doing it myself, but how do I get it published on the D site?That is a common mistake. I know I've done that. I think people have posted bug reports on this. I don't know if Walter would include that in the docs, but I'm sure you could add it to the Wiki4D's FAQ page: http://www.wikiservice.at/d/wiki.cgi?FaqRoadmap.C-- Justin http://jcc_7.tripod.com/d/
Mar 16 2004
"C" <C_member pathlink.com> wrote in message news:c37jjq$1fg6$1 digitaldaemon.com...It took me a day to figure out that to use modules I had to specify thefiles inthe compile command. I just misunderstood the way the import keywordworked. Ithought it was like #include and the compiler would chain the files beforeitcompiled. Maybe I'm just stupid, but shouldn't that be documentedsomewhere? Iwould have no problem with doing it myself, but how do I get it publishedon theD site?You arent stupid. I remember when I first started learning Java, I could not figure out how to make the packages because there was nothing on the internet about it. It must have been overlooked, which is surprising, considering how very important it is. If you document it, I would definately read it! Phill.C
Mar 17 2004
"Phill" <phill pacific.net.au> wrote in message news:c391l7$r3c$1 digitaldaemon.com..."C" <C_member pathlink.com> wrote in message news:c37jjq$1fg6$1 digitaldaemon.com...beforeIt took me a day to figure out that to use modules I had to specify thefiles inthe compile command. I just misunderstood the way the import keywordworked. Ithought it was like #include and the compiler would chain the filesitpublishedcompiled. Maybe I'm just stupid, but shouldn't that be documentedsomewhere? Iwould have no problem with doing it myself, but how do I get iton thetoD site?You arent stupid. I remember when I first started learning Java, I could not figure out howmake the packages because there was nothing on the internet about it. It must have been overlooked, which is surprising, considering how very important it is. If you document it, I would definately read it!And we'll put in in the first issue of TDJ, whenever that is ... ;)
Mar 17 2004
On Tue, 16 Mar 2004 19:12:58 +0000 (UTC), C <C_member pathlink.com> wrote:It took me a day to figure out that to use modules I had to specify the files in the compile command. I just misunderstood the way the import keyword worked. I thought it was like #include and the compiler would chain the files before itWith #include the entire content of the file specified between < and > will be inserted at the inclusion point, therefore the file does not need to be linked because the newly created object already has everything it needs. Not so with D. Importing only makes available "symbols" from the imported files. As such the file must be linked in order to resolve those symbols. It seems odd that we wouldn't be able to create a rule for the linker to automatically link all imported files. Along those same lines, shouldn't it be possible to specify libraries with which to link the current module? =========a.d=========== module a; linkwith [gdi32.lib, usr32.lib] // explicit linkage ... // do something important ======================= =========b.d=========== import a; // automatically linked upon import void main() { // do what b does best } ======================= typing the following: dmd b should expand to: dmd b a gdi32.lib usr32.lib I've only ever seen this (linkwith) used in assembly but I think it's a good feature to have.compiled. Maybe I'm just stupid, but shouldn't that be documented somewhere? I would have no problem with doing it myself, but how do I get it published on the D site? C-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Mar 17 2004
Hmm good thought , you could use Carlos' (or Lars ? sorry I forget ) = dependecy checker to extract all the modules , and write a simple compil= e = driver to do that for you. C On Wed, 17 Mar 2004 22:35:07 -0500, Andrew Edwards = <remove_ridimz remove_yahoo.com> wrote:On Tue, 16 Mar 2004 19:12:58 +0000 (UTC), C <C_member pathlink.com> =wrote:he =It took me a day to figure out that to use modules I had to specify t==files in the compile command. I just misunderstood the way the import keyword=worked. I thought it was like #include and the compiler would chain the files ==before itWith #include the entire content of the file specified between < and >=will be inserted at the inclusion point, therefore the file does not =need to be linked because the newly created object already has =everything it needs. Not so with D. Importing only makes available ="symbols" from the imported files. As such the file must be linked in =order to resolve those symbols. It seems odd that we wouldn't be able to create a rule for the linker =to =automatically link all imported files. Along those same lines, shouldn='t =it be possible to specify libraries with which to link the current =module? =3D=3D=3D=3D=3D=3D=3D=3D=3Da.d=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D module a; linkwith [gdi32.lib, usr32.lib] // explicit linkage ... // do something important =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3Db.d=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D import a; // automatically linked upon import void main() { // do what b does best } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D typing the following: dmd b should expand to: dmd b a gdi32.lib usr32.lib I've only ever seen this (linkwith) used in assembly but I think it's =a =good feature to have.compiled. Maybe I'm just stupid, but shouldn't that be documented =somewhere? I would have no problem with doing it myself, but how do I get it =-- = D Newsgroup.published on the D site? C
Mar 18 2004
In article <opr42r2pwtehmtou localhost>, C says...Hmm good thought , you could use Carlos' (or Lars ? sorry I forget ) = dependecy checker to extract all the modules , and write a simple compil= e = driver to do that for you. CNot mine: Lars'. However, digc can do that exactly. Maybe you'll want to check it. ------------------- Carlos Santander B.
Mar 18 2004