Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
March 16, 2004 using modules | ||||
---|---|---|---|---|
| ||||
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 |
March 17, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | 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/ |
March 17, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | "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 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? > 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 > > |
March 17, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | "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... > > 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? > > > 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! And we'll put in in the first issue of TDJ, whenever that is ... ;) |
March 18, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | 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 it With #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/ |
March 18, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | Hmm good thought , you could use Carlos' (or Lars ? sorry I forget ) dependecy checker to extract all the modules , and write a simple compile 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: > >> 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 > > With #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 >> >> > > > -- D Newsgroup. |
March 18, 2004 Re: using modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to C | 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.
>
>C
>
Not mine: Lars'. However, digc can do that exactly. Maybe you'll want to check it.
-------------------
Carlos Santander B.
|
Copyright © 1999-2021 by the D Language Foundation