'LPCWSTR relative path to shader issue while launching main c# application and not C++ submodule (.lib)
I'm building C# application with some C++ code just for rendering (following this great tutorial - https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), but I got stuck at line 130 - decompiling from shader.
When code is run just in C++ (for testing only) is works great, as well as when I launch it up from C# and set up absolute path to shader file (2 versions working fine below)
C++ Engine only working version:
D3DCompileFromFile(L"TestShader.hlsl", nullptr, nullptr, "vs_main", "vs_5_0", 0, 0, &vsBlob, nullptr);
C++ Engine and C# absolute path working version:
D3DCompileFromFile(L"E:\\Coding\\CPPEngine\\Graphics\\Shaders\\TestShader.hlsl", nullptr, nullptr, "vs_main", "vs_5_0", 0, 0, &vsBlob, nullptr);
but I want C#-working relative path to my CPP engine.lib working, so something like this:
D3DCompileFromFile(L"..\\CPPEngine\\Graphics\\Shaders\\TestShader.hlsl", nullptr, nullptr, "vs_main", "vs_5_0", 0, 0, &vsBlob, nullptr);
or
D3DCompileFromFile(L"..\\CPPEngine.lib\\Graphics\\Shaders\\TestShader.hlsl", nullptr, nullptr, "vs_main", "vs_5_0", 0, 0, &vsBlob, nullptr);
Just for clarification application is split in 3 modules like this:
- MainApplication(C# .exe)
- CPPLink(C++ .dll)
- CPPEngine(C++ .lib)
and the linking was working fine so far. The problem seems to be just with relative path to shaders - HRRESULT says HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) when trying examples 3 or 4.
All the files - that is:C# .exe,C++ .dll and C++ .lib are all dumped to one output folder right now (different than the source one obviously)
Is it just path issue? or I have to setup some entry points to .lib first? CPPEngine Character set is Not Set if that matters.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
