View mode: basic / threaded / horizontal-split · Log in · Help
April 24, 2005
Re: Automatically linking imports
Nils Hensel wrote:
> Derek Parnell schrieb:
...
> 
> Happy to see that there is a documentation. You don't mention that on 
> your website. I assumed the .zip file was just the source so I only 
> downloaded the .exe file.

There's online documentation, too (through the magic of SVN):

http://svn.dsource.org/svn/projects/build/trunk/Docs/index.htm

-- 
jcc7
http://jcc_7.tripod.com/d/
April 24, 2005
[Walter] Re: Automatically linking imports
"Nils Hensel" <nils.hensel@web.de> wrote in message news:d4fu8l$hbr$1@digitaldaemon.com...
> Hi,
>
> I was wondering why imported modules are not automatically linked. As I
> have been tinkering mostly with Python in the last few years I expected
> an imported module to be usable right away.
>
> Let's say I have a module called mymodule which contains some data and I
> write in example.d:
>
>    import mymodule;
>
> and compile it like
>
>    dmd example.d
>
> I get
>
>    Error 42: Symbol Undefined IMAGINE_NAME_OF_DATA_HERE
>
> unless I state that mymodule.[d|obj] shall be compiled/linked as well.
>
> Isn't it completely obvious from the import statement that I intend to
> use it? Why does it have to be explicitly declared?
>
> Regards,
> Nils
>
>

I've noticed this also.... and felt the same way about it.

Walter, is there any plan to change this?

TZ
April 24, 2005
Re: Automatically linking imports
"Nils Hensel" <nils.hensel@web.de> wrote in message news:d4g4md$muc$1@digitaldaemon.com...
> Anders F Björklund schrieb:
> > I'm not sure it's the only reason; but one reason is that the imports
> > and the implementations might be done in two *different* .d files, or
> > the implementation could even be in another language for some modules.
>
> I see the point.
>
That's exactly what was happening in my case,
and I did find that I could work around it...
but like you Anders pointed out,
it's a bit tedious.

TZ
April 24, 2005
Re: [Walter] Re: Automatically linking imports
TechnoZeus wrote:
> "Nils Hensel" <nils.hensel@web.de> wrote in message news:d4fu8l$hbr$1@digitaldaemon.com...
> 
>>Hi,
>>
>>I was wondering why imported modules are not automatically linked. As I
>>have been tinkering mostly with Python in the last few years I expected
>>an imported module to be usable right away.
>>
>>Let's say I have a module called mymodule which contains some data and I
>>write in example.d:
>>
>>   import mymodule;
>>
>>and compile it like
>>
>>   dmd example.d
>>
>>I get
>>
>>   Error 42: Symbol Undefined IMAGINE_NAME_OF_DATA_HERE
>>
>>unless I state that mymodule.[d|obj] shall be compiled/linked as well.
>>
>>Isn't it completely obvious from the import statement that I intend to
>>use it? Why does it have to be explicitly declared?

...
> I've noticed this also.... and felt the same way about it.
> 
> Walter, is there any plan to change this?
> 
> TZ

It was like pulling teeth just getting Walter to add the library pragma 
(which he did finally add). What exactly do you have in mind?

I think the major problem is that sometimes separate .obj's are used and 
sometimes the .obj's are stored in a .lib. Can DMD guess correctly where 
it's stored? What is it guesses incorrectly. Derek is trying to handle 
these issues (and doing a great job) with the Build utility 
(http://www.dsource.org/projects/build/), but it's not as simple as one 
might think.

I think Walter would rather spend his time getting the bugs out of DMD, 
so you might just try to using Build and ask Derek to add some features 
if it doesn't work the way you want it to work.

It's just a suggestion. Feel free to ignore it.

-- 
jcc7
http://jcc_7.tripod.com/d/
April 24, 2005
Re: [Walter] Re: Automatically linking imports
> Derek is trying to handle
> these issues (and doing a great job) with the Build utility
> (http://www.dsource.org/projects/build/), but it's not as simple as one
> might think.

Yea this tool is awesome, let Walter work on the big stuff, build works
awesome for me, defintely worth expending the time to learn how to use it :)

Charlie



"J C Calvarese" <jcc7@cox.net> wrote in message
news:d4h2ki$9uv$1@digitaldaemon.com...
> TechnoZeus wrote:
> > "Nils Hensel" <nils.hensel@web.de> wrote in message
news:d4fu8l$hbr$1@digitaldaemon.com...
> >
> >>Hi,
> >>
> >>I was wondering why imported modules are not automatically linked. As I
> >>have been tinkering mostly with Python in the last few years I expected
> >>an imported module to be usable right away.
> >>
> >>Let's say I have a module called mymodule which contains some data and I
> >>write in example.d:
> >>
> >>   import mymodule;
> >>
> >>and compile it like
> >>
> >>   dmd example.d
> >>
> >>I get
> >>
> >>   Error 42: Symbol Undefined IMAGINE_NAME_OF_DATA_HERE
> >>
> >>unless I state that mymodule.[d|obj] shall be compiled/linked as well.
> >>
> >>Isn't it completely obvious from the import statement that I intend to
> >>use it? Why does it have to be explicitly declared?
>
> ...
> > I've noticed this also.... and felt the same way about it.
> >
> > Walter, is there any plan to change this?
> >
> > TZ
>
> It was like pulling teeth just getting Walter to add the library pragma
> (which he did finally add). What exactly do you have in mind?
>
> I think the major problem is that sometimes separate .obj's are used and
> sometimes the .obj's are stored in a .lib. Can DMD guess correctly where
> it's stored? What is it guesses incorrectly. Derek is trying to handle
> these issues (and doing a great job) with the Build utility
> (http://www.dsource.org/projects/build/), but it's not as simple as one
> might think.
>
> I think Walter would rather spend his time getting the bugs out of DMD,
> so you might just try to using Build and ask Derek to add some features
> if it doesn't work the way you want it to work.
>
> It's just a suggestion. Feel free to ignore it.
>
> --
> jcc7
> http://jcc_7.tripod.com/d/
April 24, 2005
Re: [Walter] Re: Automatically linking imports
"J C Calvarese" <jcc7@cox.net> wrote in message news:d4h2ki$9uv$1@digitaldaemon.com...
*snip*
> It was like pulling teeth just getting Walter to add the library pragma
> (which he did finally add). What exactly do you have in mind?
*snip*
> jcc7
> http://jcc_7.tripod.com/d/

I didn't actually have anything specific in mind at all.
It was simply a question.
Mainly, I was wondering if Walter already had something in mind.

TZ
April 24, 2005
Re: Automatically linking imports
On Sun, 24 Apr 2005 20:31:00 +0200, Nils Hensel wrote:

> Derek Parnell schrieb:
I ran a test with both of the files you provided and they worked without
error, as I expected them to. So now I'm thinking that maybe I don't
understand the error you are seeing. Can I ask another favour from you; can
you run Build again with either or both of these 'wsdefs' files, but this
time use the -V switch. This will display an enormous amount of
information. Can you send me this stuff so I can analyze the error
message(s)?

e.g.
 build -V yourapp >build_dump.txt

My email is ddparnell (a.t) bigpond (d.o.t) com

> Happy to see that there is a documentation. You don't mention that on 
> your website. I assumed the .zip file was just the source so I only 
> downloaded the .exe file.

Huh? Of course there is documentation. Why would anyone release a product
without documentation? That just doesn't make sense.

By the way, I didn't mention that there was any source code in the ZIP file
either ;-) But I get the point; I'll explicitly release the documentation
as a separate download for those who want to read about it before trying
it. Thanks for the heads-up.

-- 
Derek Parnell
Melbourne, Australia
http://www.dsource.org/projects/build
25/04/2005 8:27:27 AM
April 24, 2005
Re: Automatically linking imports
"Derek Parnell" <derek@psych.ward> wrote in message 
news:voiulhbsvc09.1dk3johj3w80g$.dlg@40tude.net...
.............
>
> You can find out more at http://www.dsource.org/projects/build
>

Is the dsource.org site frequently down?

Tried to access it a few times, but to no avail.
April 24, 2005
Re: Automatically linking imports
"Nils Hensel" <nils.hensel@web.de> wrote in message
news:d4fu8l$hbr$1@digitaldaemon.com...
> I was wondering why imported modules are not automatically linked. As I
> have been tinkering mostly with Python in the last few years I expected
> an imported module to be usable right away.

Because it isn't always obvious what the name of the imported object file
is - or even if it is in a library instead. Also, one does not always want
to link in the module, for example, if it contains references to C global
variables.
April 25, 2005
Re: Automatically linking imports
Bob W wrote:
> "Derek Parnell" <derek@psych.ward> wrote in message 
> news:voiulhbsvc09.1dk3johj3w80g$.dlg@40tude.net...
> .............
> 
>>You can find out more at http://www.dsource.org/projects/build
>>
> 
> 
> Is the dsource.org site frequently down?
> 
> Tried to access it a few times, but to no avail.

I think there have been problems with too much traffic on weekdays from 
about 8-10 am Central Time (US), but I don't know of any common problems 
on weekends. It's been working fine for me today.

-- 
jcc7
http://jcc_7.tripod.com/d/
1 2 3
Top | Discussion index | About this forum | D home