From 2ecd3772e3805992f48bb806fd6a595048441011 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Fri, 4 Sep 2015 14:05:00 -0500 Subject: [PATCH] mscoree: Send Mono's debug output to Unix stderr. --- dlls/mscoree/metahost.c | 18 ++++++++++++++++++ dlls/mscoree/mscoree_private.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 5e32ecba219..6b53cde4b7a 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -102,6 +102,8 @@ static char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname); MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain); void (CDECL *mono_thread_manage)(void); void (CDECL *mono_trace_set_assembly)(MonoAssembly *assembly); +void (CDECL *mono_trace_set_print_handler)(MonoPrintCallback callback); +void (CDECL *mono_trace_set_printerr_handler)(MonoPrintCallback callback); static BOOL get_mono_path(LPWSTR path); @@ -111,12 +113,18 @@ static MonoAssembly* mono_assembly_preload_hook_fn(MonoAssemblyName *aname, char static void mono_shutdown_callback_fn(MonoProfiler *prof); +static void mono_print_handler_fn(const char *string, INT is_stdout); + static MonoImage* CDECL image_open_module_handle_dummy(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status) { return mono_image_open(fname, status); } +static void CDECL set_print_handler_dummy(MonoPrintCallback callback) +{ +} + static void missing_runtime_message(void) { MESSAGE("wine: Install Mono for Windows to run .NET applications.\n"); @@ -204,11 +212,16 @@ static HRESULT load_mono(LPCWSTR mono_path) } while (0); LOAD_OPT_MONO_FUNCTION(mono_image_open_from_module_handle, image_open_module_handle_dummy); + LOAD_OPT_MONO_FUNCTION(mono_trace_set_print_handler, set_print_handler_dummy); + LOAD_OPT_MONO_FUNCTION(mono_trace_set_printerr_handler, set_print_handler_dummy); #undef LOAD_OPT_MONO_FUNCTION mono_profiler_install(NULL, mono_shutdown_callback_fn); + mono_trace_set_print_handler(mono_print_handler_fn); + mono_trace_set_printerr_handler(mono_print_handler_fn); + mono_set_dirs(mono_lib_path_a, mono_etc_path_a); mono_config_parse(NULL); @@ -244,6 +257,11 @@ static void mono_shutdown_callback_fn(MonoProfiler *prof) is_mono_shutdown = TRUE; } +static void mono_print_handler_fn(const char *string, INT is_stdout) +{ + wine_dbg_printf("%s", string); +} + static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost **result) { HRESULT hr = S_OK; diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index 0fbbff67a21..9a7678dd08e 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -132,6 +132,8 @@ typedef MonoAssembly* (*MonoAssemblyPreLoadFunc)(MonoAssemblyName *aname, char * typedef void (*MonoProfileFunc)(MonoProfiler *prof); +typedef void (*MonoPrintCallback) (const char *string, INT is_stdout); + extern BOOL is_mono_started DECLSPEC_HIDDEN; extern MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly) DECLSPEC_HIDDEN; @@ -156,6 +158,8 @@ extern MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str) extern MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain) DECLSPEC_HIDDEN; extern void (CDECL *mono_thread_manage)(void) DECLSPEC_HIDDEN; extern void (CDECL *mono_trace_set_assembly)(MonoAssembly *assembly) DECLSPEC_HIDDEN; +extern void (CDECL *mono_trace_set_print_handler)(MonoPrintCallback callback) DECLSPEC_HIDDEN; +extern void (CDECL *mono_trace_set_printerr_handler)(MonoPrintCallback callback) DECLSPEC_HIDDEN; /* loaded runtime interfaces */ extern void expect_no_runtimes(void) DECLSPEC_HIDDEN; -- 2.11.4.GIT