2
votes

I have a terrain generation engine written in C++/DirectX11 and I think the same issue, though not solved, like this one:

DirectX Release build works through VS2010, but not exe

Saying briefly: Configuration in VS is set to default Release mode (platform x86). However, it works properly when I run it through VS, but shows strange artifacts when run as stand-alone exe. But when I set in configuration the Runtime library to the Multi-threaded Debug DLL (in Release mode) it works even as stand-alone, but I shouldn't put debug dll into release... This also happens when using static linking (Multi-threaded /MT). So the app works outside with debug linking but not with release.

From VS2013 (ok): http://i838.photobucket.com/albums/zz306/jajcek/artifacts_isok_zps69abbb9f.png

As stand-alone exe (not ok): http://i838.photobucket.com/albums/zz306/jajcek/artifacts_zpsfd28d68b.png

I was thinking that it might be something with dependencies, so I looked at it from Dependency Walker, but it showed me errors on this ("cannot find file"):

API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL

which led me to the topic which explains they are just misleading: Win 7, 64 bit, dll problems

Maybe as stand-alone application the exe takes the wrong dll (older ones?), I have actually installed Redistributable packages 2005, 2008, 2010, 2012 (at once) and even tried to install 2013 which didn't help me either. I also removed them all (one by one starting from the oldest) from the Control Panel and the application still runs, but again with the artifacts.

I even tried to copy the DLLs into the directory which I am running the exe from. The list of DLL was taken from VS debug window:

'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'3d_engine.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgidebug.dll'. Cannot find or open the PDB file.
// omitted

but as you suppose it didn't work either...

What does the VS2013 do to the application when it runs it? Doesn't it just run the exe from the Release directory?

I am completely confused and don't know what I should check more. Could you give me any thins, please?

1
What happens if you disable optimization in release mode? In most cases this kind of problem is a bug in your code that is affected by debug/release differences.user180326
@jdv-JandeVaan I have turned them off (Optimization in C++/Linking, Enable Intrinsic functions, Reference, Enable COMDAT), but it didn't help.tobi

1 Answers

1
votes

There are two differences that come to mind:

  1. When running from VS, you are probably still running inside a debugger, which can be detected by the process. This would be tricky to diagnose and is rather unlikely.
  2. When running from VS, it could have a different environment and working directory than what you expect, which could render paths invalid and change the set of loaded DLLs. On startup, VS displays in the debug output the loaded libraries with their paths. Compare these with the libraries when running the executable standalone using "depends.exe".

Note that the fact that using the debug DLL seems to cure the problem indicates that you are doing something wrong, like relying on initial values for uninitialized variables. Check all warnings during compilation and maybe even increase the warning level.