www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Bug? Bad file name?

reply Anonymous <jsni2005 yahoo.com> writes:
I was playing with some code someone posted on the forum that 
involved opDispatch and compile time parameters. I pasted it in a 
file named templOpDispatch.d, ran it, and got an error. Then I 
noticed if I renamed the file it worked.

The source didn't matter; same thing happens with an empty main.

Ex: templOpDispatch.d contains just

     void main() {}

Then running 'rdmd templOpDispatch.d' produces:

std.process.ProcessException std\process.d(568): Failed to spawn 
new process (The requested operation requires elevation.)
----------------
0x004396F0
0x0042AC3A
0x00403F66
0x00403FDF
0x00433043
0x00432F57
0x00426B70
0x7577337A in BaseThreadInitThunk
0x77969882 in RtlInitializeExceptionChain
0x77969855 in RtlInitializeExceptionChain

Windows 7
rdmd build 20150923
DMD32 D Compiler v2.068.2

But I can rename the file to rdmd templOpDispatc.d (remove h) and 
all is good. Strange. Can anyone else reproduce this?
Nov 13 2015
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Saturday, 14 November 2015 at 05:44:44 UTC, Anonymous wrote:
 I was playing with some code someone posted on the forum that 
 involved opDispatch and compile time parameters. I pasted it in 
 a file named templOpDispatch.d, ran it, and got an error. Then 
 I noticed if I renamed the file it worked.

 The source didn't matter; same thing happens with an empty main.

 Ex: templOpDispatch.d contains just

     void main() {}

 Then running 'rdmd templOpDispatch.d' produces:

 std.process.ProcessException std\process.d(568): Failed to 
 spawn new process (The requested operation requires elevation.)
 ----------------
 0x004396F0
 0x0042AC3A
 0x00403F66
 0x00403FDF
 0x00433043
 0x00432F57
 0x00426B70
 0x7577337A in BaseThreadInitThunk
 0x77969882 in RtlInitializeExceptionChain
 0x77969855 in RtlInitializeExceptionChain

 Windows 7
 rdmd build 20150923
 DMD32 D Compiler v2.068.2

 But I can rename the file to rdmd templOpDispatc.d (remove h) 
 and all is good. Strange. Can anyone else reproduce this?
What about other file names that contain compiler recognised names / keywords?
Nov 14 2015
prev sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 14 November 2015 at 05:44:44 UTC, Anonymous wrote:
 Then running 'rdmd templOpDispatch.d' produces:

 std.process.ProcessException std\process.d(568): Failed to 
 spawn new process (The requested operation requires elevation.)
This is a Windows quirk. When they introduced UAC in Windows Vista, several programs required admin elevation to be run, but a lot of old programs didn't request it. So Microsoft put in a bit of a hack to keep things working: programs named things like setup.exe or patch.exe, which typically need to write to installed programs, are assumed to need elevation. There's ways around it: http://stackoverflow.com/questions/533939/how-to-prevent-vista-from-requiring-elevation-on-patch-exe But it isn't a D thing per se, it is Windows seeing the "patch.exe" at the end of the "templOpDispatch.exe" filename (default name is to replace the .d with .exe) and assuming it is some installed application updater. Easiest thing to do is to just not call your program that.
Nov 14 2015