Skip to content

Commit 54dbf5c

Browse files
committed
[MERGE #1344 @dilijev] Statically link C++ Runtime into ChakraCore.dll.
Merge pull request #1344 from dilijev:static (Request from TypeScript team.) This enables us to support running applications developed against ChakraCore.dll even if the C++ Runtime is not installed on the machine. Add this to Build/Chakra.Build.Default.props to set the flag for the entire build. If the user wishes to dynamically link the C++ Runtime, build with e.g. msbuild ... "/p:RuntimeLib=dynamic_library" (or any other value for RuntimeLib) to disable the static linking. Confirmed that ch.exe is now able to run a hello.js file on a machine without the C++ Runtime installed. (Dynamically linked ChakraCore.dll fails on the same machine complaining of missing DLLs.) Note: * Increases x64_debug ChakraCore.dll size by about 1MB. * Increases x64_release ChakraCore.dll size by about 100KB. * Increases x64_release_pogo ChakraCore.dll size by about 150KB.
2 parents 6a784c2 + 02aff24 commit 54dbf5c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Build/Chakra.Build.Default.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
<!-- Always use Platform SDK for core builds -->
88
<EventManifestXmlPath>$(WindowsSDK80Path)Include\um</EventManifestXmlPath>
99

10+
<!-- Unless indicated otherwise, statically link the C++ Runtime into ChakraCore.dll -->
11+
<RuntimeLib Condition="'$(RuntimeLib)'==''">static_library</RuntimeLib>
12+
1013
</PropertyGroup>
1114
</Project>

bin/ch/WScriptJsrt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ JsValueRef __stdcall WScriptJsrt::EchoCallback(JsValueRef callee, bool isConstru
6565
}
6666

6767
wprintf(L"\n");
68+
fflush(stdout);
6869

6970
JsValueRef undefinedValue;
7071
if (ChakraRTInterface::JsGetUndefinedValue(&undefinedValue) == JsNoError)

lib/Common/Core/Output.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Output::VerboseNote(const char16 * format, ...)
5252
va_list argptr;
5353
va_start(argptr, format);
5454
size_t size = vfwprintf(stdout, format, argptr);
55+
fflush(stdout);
5556
va_end(argptr);
5657
return size;
5758
}
@@ -344,10 +345,7 @@ Output::PrintBuffer(const char16 * buf, size_t size)
344345
}
345346
}
346347

347-
if (IsDebuggerPresent())
348-
{
349-
Output::Flush();
350-
}
348+
Output::Flush();
351349

352350
return size;
353351
}

0 commit comments

Comments
 (0)