www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dmd -o- option meaning changed recently? Now not creating OBJ but also

reply A D dev <addev dlang.com> writes:
Hi list,

I'm in the beginning stages of learning D. Enjoying it, but get 
some issues now and then. This is one.

When I compile single-file D programs, I don't want to keep the 
generated object file (.OBJ, on Windows). I had checked the D 
compiler options for this (using dmd --help), and IIRC, a few 
weeks ago, I had used the -o- option (do not write object file) 
with a few single-file programs, to disable the creation of the 
.OBJ file, i.e. only the .EXE file got created - which is what I 
wanted.

Recently I upgraded to the current version of DMD. Then a bit 
later, I had a need to do that kind of single-file compile again. 
And when I used the -o- option, I was surprised to see that it 
did not create the .OBJ file, but did not create the EXE file 
either. I have checked this today, for example. That made me 
wonder whether the behavior of the -o- option was changed between 
versions, and if so, why.

Also, somewhere in between the above two events, I think (but am 
not sure) that I may have got a message (while compiling) that 
-o- option is not supported (maybe with a compiler version in 
between the other two ones), or something like it. Unfortunately 
I did not save that compile command, compiler version and error 
info (though I should have, and usually do), so I cannot say 
exactly what that issue was. But mentioning it in case it was 
right and relevant.

Can anyone explain this (assuming I got all my facts right, 
otherwise please feel free to say how and where I got it wrong - 
will appreciate either).

Thanks.
Oct 02 2016
parent reply ag0aep6g <anonymous example.com> writes:
On 10/02/2016 10:33 PM, A D dev wrote:
 When I compile single-file D programs, I don't want to keep the
 generated object file (.OBJ, on Windows). I had checked the D compiler
 options for this (using dmd --help), and IIRC, a few weeks ago, I had
 used the -o- option (do not write object file) with a few single-file
 programs, to disable the creation of the .OBJ file, i.e. only the .EXE
 file got created - which is what I wanted.
I think you may be misremembering things. I've checked versions back to 2.051 (from 2010, oldest I've got lying around). None of them wrote an executable with -o-.
Oct 02 2016
parent reply A D dev <addev dlang.com> writes:
On Sunday, 2 October 2016 at 20:47:44 UTC, ag0aep6g wrote:

 I think you may be misremembering things. I've checked versions 
 back to 2.051 (from 2010, oldest I've got lying around). None 
 of them wrote an executable with -o-.
1. Thanks a lot for all that checking and for your reply. 2.
 I've checked versions back to 2.051 (from 2010, oldest I've got 
 lying around).
Great idea, wish I had thought of that myself. Will do it in future - keep some older versions of the compiler or its zip file, so that I can check for such things if they arise. 3.
 I think you may be misremembering things. I've checked versions 
 back to 2.051 (from 2010, oldest I've got lying around). None 
 of them wrote an executable with -o-.
You may well be right. I did say that in my original post, though not sure why I would misremember. But I acknowledge the possibility. I did find it weird that it would not create BOTH an OBJ and EXE (now, with -o-) and did create only an EXE (before, with -o-), if both those things were actually the case. Because that is too big a thing to happen as a mistake by the D team. And I could not think of a good reason why they might do it on purpose. Could understand if for some reason the automatic .OBJ deletion was suppressed, but no good reason for at the same time preventing the generation of the EXE. One last point: If that was always the behavior (in all versions from 2010 - or earlier), i.e. -o- generates neither .OBJ nor .EXE, then what is the purpose of the option? does it act as just a syntax check? Anyway, moral of the story (for me) is to be more careful next time and record all my actions / command history for cases like this - which I generally try to do, but did not this time.
Oct 02 2016
parent reply Dicebot <public dicebot.lv> writes:
On Sunday, 2 October 2016 at 21:05:25 UTC, A D dev wrote:
 One last point:

 If that was always the behavior (in all versions from 2010 - or 
 earlier), i.e. -o- generates neither .OBJ nor .EXE, then what 
 is the purpose of the option? does it act as just a syntax 
 check?
Purpose is to skip code generation and only do syntax/semantic validation. Very helpful when testing compiler because: a) it takes less time speeding up overall test suite b) doesn't require runtime static library to succeed, thus simplifying setup
Oct 03 2016
parent A D dev <addev dlang.com> writes:
On Monday, 3 October 2016 at 09:06:32 UTC, Dicebot wrote:

 Purpose is to skip code generation and only do syntax/semantic 
 validation. Very helpful when testing compiler because:

 a) it takes less time speeding up overall test suite
 b) doesn't require runtime static library to succeed, thus 
 simplifying setup
Thanks, Dicebot. Only saw your message now, sorry.
Oct 11 2016