October 15, 2012
On 15/10/12 11:14, Jacob Carlborg wrote:
> Just use DVM, it's also cross-platform:
>
> https://bitbucket.org/doob/dvm

I tried that on both Windows and Ubuntu, and couldn't get it to work on either of them. I posted a couple of bug reports eight months ago, and they still haven't been fixed. Not recommended for anyone who is having problems with their installation.
October 15, 2012
Jacob Carlborg:

> How should DMD detect if you're building a (dynamic) library? Sure it can see that you're not using -lib or -shared but what about separate complication?

What about the need to use a compiler switch if you are performing a separate compilation?

A related enhancement request that I'm asking for since years is: the compiler could define a compile-time constant (like is_main_module or something) as true if the module contains the main, and false otherwise. This allows to have a main() in each module. This is handy to have, it allows to compile&run modules both as normal modules to import, or to compile and run them as stand alone programs, like when you want a module to show a demo of its capabilities, or just run its unittests.

Bye,
bearophile
October 15, 2012
On Monday, 15 October 2012 at 11:20:26 UTC, bearophile wrote:
> Jacob Carlborg:
>
>> How should DMD detect if you're building a (dynamic) library? Sure it can see that you're not using -lib or -shared but what about separate complication?
>
> What about the need to use a compiler switch if you are performing a separate compilation?
>
> A related enhancement request that I'm asking for since years is: the compiler could define a compile-time constant (like is_main_module or something) as true if the module contains the main, and false otherwise. This allows to have a main() in each module. This is handy to have, it allows to compile&run modules both as normal modules to import, or to compile and run them as stand alone programs, like when you want a module to show a demo of its capabilities, or just run its unittests.
>
> Bye,
> bearophile

Yes, this is a nice thing Java, .NET and Python have.


October 15, 2012
On 2012-10-15 11:58, Don Clugston wrote:

> I tried that on both Windows and Ubuntu, and couldn't get it to work on
> either of them. I posted a couple of bug reports eight months ago, and
> they still haven't been fixed. Not recommended for anyone who is having
> problems with their installation.

I know it's not a perfect tool and it contains bugs but most things do work. I don't know which issues have been reported by you, but it seems there's a problem with the "-l" flag. Running "dvm install 2.060" usually works. Could you please point out which issues have been reported by you.

I have very limited time to work with D, as I understand most people here has, and I'm currently working on other projects than DVM since basically does what I intended it to do when I started the project.

It seems most D installers are broken in one way or another. But the success rate with DVM seems to be quite high anyway.

-- 
/Jacob Carlborg
October 15, 2012
On Mon, 15 Oct 2012 07:43:54 +0100, Alex Rønne Petersen <alex@lycus.org> wrote:
> Yep, those errors are always a sign that a proper main function is missing. I have no idea why you would get it otherwise, though.

So.. is it possible to save the source file in such a way that dmd cannot "see" main?

i.e. not ASCII, UTF-8/16/32 or with a weird BOM, or no BOM or..

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
October 15, 2012
Regan Heath:

> So.. is it possible to save the source file in such a way that dmd cannot "see" main?

This is a dirty solution (a hack). I don't like that.

Bye,
bearophile
October 15, 2012
On Mon, 15 Oct 2012 13:08:42 +0100, bearophile <bearophileHUGS@lycos.com> wrote:

> Regan Heath:
>
>> So.. is it possible to save the source file in such a way that dmd cannot "see" main?
>
> This is a dirty solution (a hack). I don't like that.

Err.. I was suggesting this might be the OP's problem (I hadn't read the entire thread to know the actual problem was a bad package).  I wondered if perhaps he had accidentally created an invalid D source file.  I suspect the compiler complains when it encounters bad source files..

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
October 15, 2012
On Monday, 15 October 2012 at 11:20:26 UTC, bearophile wrote:
> This allows to have a main() in each module.

You could just version it:

version(foo_main)
void main() {}
October 15, 2012
On Monday, 15 October 2012 at 03:10:59 UTC, Gerry Weaver wrote:
>  I install the latest package and try to build "Hello World".

I've always used the .zip and found it to be the easiest way (and btw, don't follow the terrible installation instructions, just unzip it and use right out of the box).

$ wget blah/dmd.version.zip
$ unzip dmd.version.zip
$ dmd2/src/linux32/bin/dmd hello.d

You can of course also add that to your $PATH or use a wrapper script or whatever so you can refer to it easier.


That has consistently worked for me for many years. You can install it in /opt or in your own $HOME (my preference, so I don't even have to bother with root).
October 15, 2012
Le 15/10/2012 09:08, Gerry Weaver a écrit :
> On Monday, 15 October 2012 at 06:47:06 UTC, Jonathan M Davis wrote:
>> On Sunday, October 14, 2012 23:40:41 H. S. Teoh wrote:
>>> Funny, as soon as I said that, I manage to reproduce the same error
>>> messages (though I can't say if it's exactly the problem you're seeing)
>>> by compiling a file that doesn't define main(). In this case, I had a
>>> hello.d with main() renamed to Main():
>>
>> Yes. The error message that he's getting is essentially the one that
>> you get
>> when you don't define main, which is weird, because he _is_ defining
>> main. But I
>> don't know if it's exactly the same or not. A detailed comparison of
>> the error
>> messages that he's seeing and those that you get from not defining
>> main on a
>> machine that works would be required to see whether it's exactly the same
>> message or not.
>>
>> I'm surprised that you didn't recognize the errors immediately. I
>> guess that
>> you haven't missed main very often (I'm used to it primarily from
>> forgetting
>> main when throwing together quick test scripts). But I'm totally
>> stumped as to
>> why he'd be getting them, since he does appear to be declaring main
>> correctly.
>>
>> - Jonathan M Davis
>
> Hi,
>
> I decided to install the same distribution in a vm. This time instead of
> installing the .deb package, I went with the zip. Everything seems to be
> working! I can compile a non-trivial example just fine. I guess I'll
> definitely be using the zip from now on. Anyway, I also tried the zip
> version on Mac and Windoze. They both built the same code successfully.
> This is great! I can finally try out all of those great language
> features I've been reading about.
>
> Thanks to everyone for pushing me down the rabbit hole far enough this
> time to get some payback ;-) It's on now!
>
> Thanks,
> -G
>

I would definitively encourage you to try the .deb on a clean install. I'm pretty sure your old install is confused by old half installed D stuffs.