Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5773)

Unified Diff: chrome/split_dll_fake_entry.cc

Issue 15067010: split_link tool, config, and scripts for windows build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_dll.gypi ('k') | tools/win/split_link/check_installed.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/split_dll_fake_entry.cc
diff --git a/chrome/split_dll_fake_entry.cc b/chrome/split_dll_fake_entry.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3ec8d729f8b478e02649caa389f0d734132ec4af
--- /dev/null
+++ b/chrome/split_dll_fake_entry.cc
@@ -0,0 +1,38 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <windows.h>
+
+extern "C" {
+
+// This entry point and file is used to work around circular dependencies
+// between the split DLLs. The CRT initialization will fail if done at attach
+// time. Instead, we defer initialization until after both DLLs are loaded and
+// then manually call the CRT initialization function (via DoDeferredCrtInit).
+//
+// ChromeEmptyEntry is the DLL's entry point.
+
+BOOL WINAPI _DllMainCRTStartup(HINSTANCE, DWORD, LPVOID);
+
+BOOL WINAPI ChromeEmptyEntry(HINSTANCE hinstance,
+ DWORD reason,
+ LPVOID reserved) {
+ if (reason != DLL_PROCESS_ATTACH)
+ _DllMainCRTStartup(hinstance, reason, reserved);
+ return 1;
+}
+
+__declspec(dllexport) void __stdcall DoDeferredCrtInit(HINSTANCE hinstance) {
+ _DllMainCRTStartup(hinstance, DLL_PROCESS_ATTACH, NULL);
+}
+
+// This function is needed for the linker to succeed. It seems to pick the
+// CRT lib based on the existence of "DllMain", and since we're renaming that,
+// it instead chooses the one that links against "main". This function should
+// never be called.
+int main() {
+ __debugbreak();
+}
+
+}
« no previous file with comments | « chrome/chrome_dll.gypi ('k') | tools/win/split_link/check_installed.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698