Skip to content

Instantly share code, notes, and snippets.

@tynril
Created August 6, 2012 17:24
Show Gist options
  • Save tynril/3276916 to your computer and use it in GitHub Desktop.
Save tynril/3276916 to your computer and use it in GitHub Desktop.
Patch for HXCPP (r559) to disable buffering on standard out (fixes the issue regarding traces displayed at process exit)
Index: include/hx/StdLibs.h
===================================================================
--- include/hx/StdLibs.h (revision 559)
+++ include/hx/StdLibs.h (working copy)
@@ -32,6 +32,7 @@
void __hxcpp_print(Dynamic &inV);
void __hxcpp_println(Dynamic &inV);
void __trace(Dynamic inPtr, Dynamic inData);
+void __hxcpp_stdlibs_boot();
// --- Maths ---------------------------------------------------------
double __hxcpp_drand();
Index: src/hx/StdLibs.cpp
===================================================================
--- src/hx/StdLibs.cpp (revision 559)
+++ src/hx/StdLibs.cpp (working copy)
@@ -126,6 +126,12 @@
return (lo | (mid<<12) | (hi<<24) ) % inMax;
}
+void __hxcpp_stdlibs_boot()
+{
+ // Disables standard output buffering.
+ setbuf(stdout, NULL);
+}
+
void __trace(Dynamic inObj, Dynamic inData)
{
#ifdef HX_UTF8_STRINGS
Index: src/hx/Boot.cpp
===================================================================
--- src/hx/Boot.cpp (revision 559)
+++ src/hx/Boot.cpp (working copy)
@@ -13,7 +13,7 @@
setvbuf( stderr , 0 , _IONBF , 0 );
#endif
-
+ __hxcpp_stdlibs_boot();
Object::__boot();
Dynamic::__boot();
Class_obj::__boot();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment