Index: src/examples/coroutine.c
===================================================================
--- src/examples/coroutine.c	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#include <fstream>
-#include <threads>
-
-struct Fibonacci {
-      coroutine c;
-      coVtable v;
-      int fn; // used for communication
-};
-
-coroutine* this_coroutine(Fibonacci* this);
-void co_main(Fibonacci* this);
-coVtable* vtable(Fibonacci* this);
-
-void co_main_fib(void* this) {
-      co_main( (Fibonacci*) this );
-}
-
-coroutine* this_coroutine_fib(void* this) {
-      return this_coroutine( (Fibonacci*) this);
-}
-
-void ?{}(Fibonacci* this) {
-      this->fn = 0;
-      this->v.main = co_main_fib;
-      this->v.this_coroutine = this_coroutine_fib;
-      start(this);
-}
-
-void co_main(Fibonacci* this) {
-      sout | "Starting main of coroutine " | this | endl;
-      sout | "Started from " | this_coroutine(this)->last | endl;
-      int fn1, fn2; 		// retained between resumes
-      this->fn = 0;
-      fn1 = this->fn;
-      suspend(); 		// return to last resume
-
-      this->fn = 1;
-      fn2 = fn1;
-      fn1 = this->fn;
-      suspend(); 		// return to last resume
-
-      for ( ;; ) {
-            this->fn = fn1 + fn2;
-            fn2 = fn1;
-            fn1 = this->fn;
-            suspend(); 	// return to last resume
-      }
-}
-
-int next(Fibonacci* this) {
-      resume(this); // transfer to last suspend
-      return this->fn;
-}
-
-coroutine* this_coroutine(Fibonacci* this) {
-      return &this->c;
-}
-
-coVtable* vtable(Fibonacci* this) {
-      return &this->v;
-}
-
-int main() {
-      Fibonacci f1;
-      sout | "User coroutine : " | &f1 | endl;
-      for ( int i = 1; i <= 10; i += 1 ) {
-            sout | next(&f1) | endl;
-      }
-
-      return 0;
-}
Index: src/libcfa/assert
===================================================================
--- src/libcfa/assert	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ src/libcfa/assert	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -17,5 +17,8 @@
 #define __ASSERT_H__
 
+#ifdef __CFORALL__
 extern "C" {
+#endif //__CFORALL__
+
 	#include <assert.h>
 
@@ -29,5 +32,8 @@
 		void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) __attribute__((noreturn));
 	#endif
-}
+	
+#ifdef __CFORALL__
+} // extern "C"
+#endif //__CFORALL__
 
 #endif // __ASSERT_H__
Index: src/libcfa/concurrency/invoke.c
===================================================================
--- src/libcfa/concurrency/invoke.c	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ src/libcfa/concurrency/invoke.c	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -4,4 +4,5 @@
 #include <stdio.h>
 
+#include "libhdr.h"
 #include "invoke.h"
 
@@ -18,5 +19,5 @@
 void __invokeCoroutine__F_P9scoVtablePv__1(struct coVtable *vtable, void* vthis)
 {
-      printf("Invoke : Received %p (v %p)\n", vthis, vtable);
+      LIB_DEBUG_PRINTF("Invoke : Received %p (v %p)\n", vthis, vtable);
 
       struct coroutine* cor = vtable->this_coroutine(vthis);
@@ -34,12 +35,5 @@
       void (*invoke)(struct coVtable *, void *)
 ) {
-
-      #if ! defined( __x86_64__ ) && ! defined( __i386__ )
-            #error Only __x86_64__ and __i386__ is supported for threads in cfa
-      #endif
-
-      #if defined( __U_SWAPCONTEXT__ )
-            #error __U_SWAPCONTEXT__ should not be defined for __x86_64__
-      #endif
+      LIB_DEBUG_PRINTF("StartCoroutine : Passing in %p (v %p) to %p\n", vthis, vtable, invoke);
 
       struct coVtable * vtable = get_vtable( vthis );
@@ -47,14 +41,32 @@
       struct coStack_t* stack = &this->stack;
 
+#if defined( __i386__ )
+
+	struct FakeStack {
+	    void *fixedRegisters[3];		  	// fixed registers ebx, edi, esi (popped on 1st uSwitch, values unimportant)
+	    void *rturn;				      // where to go on return from uSwitch
+	    void *dummyReturn;				// fake return compiler would have pushed on call to uInvoke
+	    void *argument[2];				// for 16-byte ABI, 16-byte alignment starts here
+	    void *padding[2];				// padding to force 16-byte alignment, as "base" is 16-byte aligned
+	};
+
+	((struct machine_context_t *)stack->context)->SP = (char *)stack->base - sizeof( struct FakeStack );
+	((struct machine_context_t *)stack->context)->FP = NULL;		// terminate stack with NULL fp
+
+	((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->dummyReturn = NULL;
+	((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->argument[0] = vtable; // argument to invoke
+      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->argument[1] = vthis;  // argument to invoke
+	((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = invoke;
+
+#elif defined( __x86_64__ )
+
       struct FakeStack {
             void *fixedRegisters[5];			// fixed registers rbx, r12, r13, r14, r15
             void *rturn;					// where to go on return from uSwitch
             void *dummyReturn;				// NULL return address to provide proper alignment
-      }; // FakeStack
+      };
 
       ((struct machine_context_t *)stack->context)->SP = (char *)stack->base - sizeof( struct FakeStack );
       ((struct machine_context_t *)stack->context)->FP = NULL;		// terminate stack with NULL fp
-
-      fprintf(stderr, "StartCoroutine : Passing in %p (v %p) to %p\n", vthis, vtable, invoke);
 
       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->dummyReturn = NULL;
@@ -63,3 +75,6 @@
       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = vthis;
       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[2] = invoke;
+#else
+      #error Only __i386__ and __x86_64__ is supported for threads in cfa
+#endif
 }
Index: src/libcfa/concurrency/threads.c
===================================================================
--- src/libcfa/concurrency/threads.c	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ src/libcfa/concurrency/threads.c	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -166,5 +166,4 @@
 	coroutine* dst = this_coroutine(cor);
 
-	fprintf(stderr, "Resuming %p from %p\n", dst, src);
 	if ( src != dst ) {				// not resuming self ?
 		assertf( dst->notHalted , 
@@ -172,5 +171,4 @@
 			"Possible cause is terminated coroutine's main routine has already returned.",
 			src->name, src, dst->name, dst );
-		fprintf(stderr, "Assigning last pointer\n");
 		dst->last = src;					// set last resumer
 	} // if
Index: src/libcfa/libhdr/libdebug.h
===================================================================
--- src/libcfa/libhdr/libdebug.h	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ src/libcfa/libhdr/libdebug.h	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -25,4 +25,12 @@
 #endif
 
+#ifdef __CFA_DEBUG_PRINT__
+      #define LIB_DEBUG_PRINTF(...)   printf (__VA_ARGS__)
+      #define LIB_DEBUG_FPRINTF(...) fprintf (stderr, __VA_ARGS__)
+#else
+      #define LIB_DEBUG_PRINTF(...)  ((void)0)
+      #define LIB_DEBUG_FPRINTF(...) ((void)0)
+#endif
+
 #endif //__LIB_DEBUG_H__
 
Index: src/libcfa/stdhdr/assert.h
===================================================================
--- src/libcfa/stdhdr/assert.h	(revision e4745d7a69e805e1610459cace93880b062586f3)
+++ src/libcfa/stdhdr/assert.h	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -14,7 +14,14 @@
 // 
 
+#ifdef __CFORALL__
 extern "C" {
-#include_next <assert.h>								// has internal check for multiple expansion
+#endif //__CFORALL__
+
+// has internal check for multiple expansion
+#include_next <assert.h>
+
+#ifdef __CFORALL__
 } // extern "C"
+#endif //__CFORALL__
 
 // Local Variables: //
Index: src/tests/.expect/coroutine.txt
===================================================================
--- src/tests/.expect/coroutine.txt	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
+++ src/tests/.expect/coroutine.txt	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -0,0 +1,10 @@
+0 0
+1 1
+1 1
+2 2
+3 3
+5 5
+8 8
+13 13
+21 21
+34 34
Index: src/tests/coroutine.c
===================================================================
--- src/tests/coroutine.c	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
+++ src/tests/coroutine.c	(revision fef8293d2a86e9538cbd5646cd7a188ea65a33c6)
@@ -0,0 +1,75 @@
+#include <fstream>
+#include <threads>
+
+struct Fibonacci {
+      coroutine c;
+      coVtable v;
+      int fn; // used for communication
+};
+
+coroutine* this_coroutine(Fibonacci* this);
+void co_main(Fibonacci* this);
+coVtable* vtable(Fibonacci* this);
+
+void co_main_fib(void* this) {
+      co_main( (Fibonacci*) this );
+}
+
+coroutine* this_coroutine_fib(void* this) {
+      return this_coroutine( (Fibonacci*) this);
+}
+
+void ?{}(Fibonacci* this) {
+      this->fn = 0;
+      this->v.main = co_main_fib;
+      this->v.this_coroutine = this_coroutine_fib;
+      start(this);
+}
+
+void co_main(Fibonacci* this) {
+#ifdef MORE_DEBUG
+      sout | "Starting main of coroutine " | this | endl;
+      sout | "Started from " | this_coroutine(this)->last | endl;
+#endif
+      int fn1, fn2; 		// retained between resumes
+      this->fn = 0;
+      fn1 = this->fn;
+      suspend(); 		// return to last resume
+
+      this->fn = 1;
+      fn2 = fn1;
+      fn1 = this->fn;
+      suspend(); 		// return to last resume
+
+      for ( ;; ) {
+            this->fn = fn1 + fn2;
+            fn2 = fn1;
+            fn1 = this->fn;
+            suspend(); 	// return to last resume
+      }
+}
+
+int next(Fibonacci* this) {
+      resume(this); // transfer to last suspend
+      return this->fn;
+}
+
+coroutine* this_coroutine(Fibonacci* this) {
+      return &this->c;
+}
+
+coVtable* vtable(Fibonacci* this) {
+      return &this->v;
+}
+
+int main() {
+      Fibonacci f1, f2;
+#ifdef MORE_DEBUG      
+      sout | "User coroutines : " | &f1 | ' ' | &f1 | endl;
+#endif
+      for ( int i = 1; i <= 10; i += 1 ) {
+            sout | next(&f1) | ' ' | next(&f2) | endl;
+      }
+
+      return 0;
+}
