From 20b242387e6c329a2ba6261d39a05ffe9c39c6ab Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 5 Jan 2014 18:09:41 +0100 Subject: NativewindowCommon_init: Add define STDERR_TO_FILE (default undefined) to redirect stderr to file jogamp_stderr.log (Useful for Applets) --- src/nativewindow/native/NativewindowCommon.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nativewindow/native/NativewindowCommon.c') diff --git a/src/nativewindow/native/NativewindowCommon.c b/src/nativewindow/native/NativewindowCommon.c index 212bdf82f..ec7ee7728 100644 --- a/src/nativewindow/native/NativewindowCommon.c +++ b/src/nativewindow/native/NativewindowCommon.c @@ -3,6 +3,8 @@ #include #include +// #define STDERR_TO_FILE 1 + static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException"; static jclass runtimeExceptionClz=NULL; @@ -42,6 +44,11 @@ int NativewindowCommon_init(JNIEnv *env) { if(NULL==runtimeExceptionClz) { NativewindowCommon_FatalError(env, "Nativewindow: can't use %s", ClazzNameRuntimeException); } + #ifdef STDERR_TO_FILE + FILE * old_stderr = stderr; + FILE * new_stderr = freopen("jogamp_stderr.log", "w", stderr); + fprintf(stderr, "STDERR_TO_FILE: %p -> %p\n", old_stderr, new_stderr); + #endif return 1; } return 0; -- cgit v1.2.3