diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-25 23:24:02 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-25 23:24:02 +0300 |
commit | 78940b7b3c2d09985556b47fb9903364ef306a83 (patch) | |
tree | f726946a97ddaa646b0dcb6ca9a298b5149207d6 /src/miranda32 | |
parent | 4657d391c9f213c788e32347c083f2699aed672e (diff) |
miranda32.exe is compiled completely without C++ runtime, therefore it can use dynamic runtime linking
Diffstat (limited to 'src/miranda32')
-rw-r--r-- | src/miranda32/miranda32.vcxproj | 8 | ||||
-rw-r--r-- | src/miranda32/src/miranda.cpp | 21 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/miranda32/miranda32.vcxproj b/src/miranda32/miranda32.vcxproj index 42e4435e2d..4b98d8c685 100644 --- a/src/miranda32/miranda32.vcxproj +++ b/src/miranda32/miranda32.vcxproj @@ -40,13 +40,9 @@ <AdditionalManifestFiles>res/miranda32.exe.manifest</AdditionalManifestFiles>
</Manifest>
<Link>
+ <DelayLoadDLLs Condition="'$(Configuration)'=='Release'">VCRUNTIME140.dll</DelayLoadDLLs>
+ <DelayLoadDLLs Condition="'$(Configuration)'=='Debug'">ucrtbased.dll;VCRUNTIME140d.dll</DelayLoadDLLs>
<AdditionalManifestDependencies>type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;type=%27win32%27 name=%27Microsoft.Windows.Gdiplus%27 version=%271.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
</Link>
- <ClCompile>
- <RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <ClCompile>
- <RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
- </ClCompile>
</ItemDefinitionGroup>
</Project>
\ No newline at end of file diff --git a/src/miranda32/src/miranda.cpp b/src/miranda32/src/miranda.cpp index 5440cb5fb6..230d22c7be 100644 --- a/src/miranda32/src/miranda.cpp +++ b/src/miranda32/src/miranda.cpp @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
+#pragma comment(lib, "delayimp.lib")
+
typedef int (WINAPI *pfnMain)(LPTSTR);
#ifdef _WIN64
@@ -39,18 +41,23 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int) wchar_t wszPath[MAX_PATH];
GetModuleFileNameW(hInstance, wszPath, _countof(wszPath));
- wchar_t *p = wcsrchr(wszPath, '\\');
- if (p == nullptr)
- return 4;
-
// if current dir isn't set
- p[1] = 0;
+ for (int i = lstrlenW(wszPath); i >= 0; i--)
+ if (wszPath[i] == '\\') {
+ wszPath[i] = 0;
+ break;
+ }
+
SetCurrentDirectoryW(wszPath);
- wcsncat_s(wszPath, L"libs", _TRUNCATE);
+ lstrcatW(wszPath, L"\\libs");
SetDllDirectoryW(wszPath);
- wcsncat_s(wszPath, L"\\ucrtbase.dll", _TRUNCATE);
+ #ifdef _DEBUG
+ lstrcatW(wszPath, L"\\ucrtbased.dll");
+ #else
+ lstrcatW(wszPath, L"\\ucrtbase.dll");
+ #endif
LoadLibraryW(wszPath);
int retVal;
|