| Thread overview | 
|---|
| March 21, 2017dummy main option (for use with --unittest) | ||||
|---|---|---|---|---|
| 
 | ||||
| Is there some option for generating a dummy main with gdc?
Alexandrescu's book (p 133) mentions a '--main', but that doesn't seem to work for gdc, and i can't find one from 'gdc --help'.
The --unittest option does work, although, for whatever reason, you cannot just stick 'void main( ) { }' inside a unittest { } block.  (Or you can, but you won't get even a warning about conflicting symbols, so i suppose the name 'main' gets mangled somehow in this context.)
I'm using debian stretch, and thanks in advance for any clues.
 | ||||
| March 21, 2017Re: dummy main option (for use with --unittest) | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to dan | On Tuesday, 21 March 2017 at 19:17:53 UTC, dan wrote: > Is there some option for generating a dummy main with gdc? Here: http://forum.dlang.org/thread/mailman.974.1489320559.31550.digitalmars-d-learn@puremagic.com. | |||
| March 21, 2017Re: dummy main option (for use with --unittest) | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to kinke | On Tuesday, 21 March 2017 at 21:36:39 UTC, kinke wrote:
> On Tuesday, 21 March 2017 at 19:17:53 UTC, dan wrote:
>> Is there some option for generating a dummy main with gdc?
>
> Here: http://forum.dlang.org/thread/mailman.974.1489320559.31550.digitalmars-d-learn@puremagic.com.
And so recent too, good grief, the way i searched must be really lousy.
Thanks very much for pointing thous out Kinke!
dan
 | |||
| March 21, 2017Re: dummy main option (for use with --unittest) | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to dan | On Tuesday, 21 March 2017 at 21:49:05 UTC, dan wrote:
> On Tuesday, 21 March 2017 at 21:36:39 UTC, kinke wrote:
>> On Tuesday, 21 March 2017 at 19:17:53 UTC, dan wrote:
>>> Is there some option for generating a dummy main with gdc?
>>
>> Here: http://forum.dlang.org/thread/mailman.974.1489320559.31550.digitalmars-d-learn@puremagic.com.
>
> And so recent too, good grief, the way i searched must be really lousy.
>
> Thanks very much for pointing thous out Kinke!
>
> dan
You're welcome and don't worry, it was inappropriately in the 'Lean' forum. ;)
You might as well just create a temporary source file with `void main() {}`, compile it once and then always link in this object when compiling the unittests, e.g., `gdc --unittest foo.d ~/main.o && ./foo`.
 | |||
Copyright © 1999-2021 by the D Language Foundation
  Permalink
Permalink Reply
Reply