Index: libcfa/prelude/builtins.c
===================================================================
--- libcfa/prelude/builtins.c	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/prelude/builtins.c	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -9,8 +9,10 @@
 // Author           : Peter A. Buhr
 // Created On       : Fri Jul 21 16:21:03 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Oct  9 18:26:19 2020
-// Update Count     : 110
+// Last Modified By : Andrew Beach
+// Last Modified On : Tue Oct 27 14:42:00 2020
+// Update Count     : 111
 //
+
+#define __cforall_builtins__
 
 // type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions
Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/src/concurrency/coroutine.cfa	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -24,12 +24,8 @@
 #include <unistd.h>
 #include <sys/mman.h>									// mprotect
-extern "C" {
-// use this define to make unwind.h play nice, definitely a hack
-#define HIDE_EXPORTS
 #include <unwind.h>
-#undef HIDE_EXPORTS
-}
 
 #include "kernel_private.hfa"
+#include "exception.hfa"
 
 #define __CFA_INVOKE_PRIVATE__
Index: libcfa/src/concurrency/exception.cfa
===================================================================
--- libcfa/src/concurrency/exception.cfa	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/src/concurrency/exception.cfa	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -10,22 +10,18 @@
 // Created On       : Mon Aug 17 10:41:00 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue Aug 25 14:41:00 2020
-// Update Count     : 0
+// Last Modified On : Wed Oct 28 14:34:00 2020
+// Update Count     : 1
 //
 
-extern "C" {
-// use this define to make unwind.h play nice, definitely a hack
-#define HIDE_EXPORTS
-#include <unwind.h>
-#undef HIDE_EXPORTS
+#define __cforall_thread__
 
-extern void __cfactx_thrd_leave();
-}
+#include "exception.hfa"
 
-#include "invoke.h"
-#include "exception.hfa"
 #include "coroutine.hfa"
 
 extern struct $thread * mainThread;
+extern "C" {
+extern void __cfactx_thrd_leave();
+}
 
 // Common pattern for all the stop functions, wait until the end then act.
Index: libcfa/src/concurrency/exception.hfa
===================================================================
--- libcfa/src/concurrency/exception.hfa	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/src/concurrency/exception.hfa	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -18,13 +18,12 @@
 // This is an internal bridge between the two modes and must be C compatable.
 
+#include <unwind.h>
 #include "bits/defs.hfa"
 #include "invoke.h"
+#include "exception.h"
 
 #ifdef __cforall
 extern "C" {
-
-#define HIDE_EXPORTS
 #endif
-#include "unwind.h"
 
 struct exception_context_t * this_exception_context(void) OPTIONAL_THREAD;
@@ -33,17 +32,5 @@
 		struct _Unwind_Exception * unwind_exception ) OPTIONAL_THREAD;
 
-struct __cfaehm_node {
-	struct _Unwind_Exception unwind_exception;
-	struct __cfaehm_node * next;
-	int handler_index;
-};
-
-static inline exception_t * __cfaehm_cancellation_exception(
-		struct _Unwind_Exception * unwind_exception ) {
-	return (exception_t *)(1 + (struct __cfaehm_node *)unwind_exception);
-}
-
 #ifdef __cforall
-#undef HIDE_EXPORTS
 }
 #endif
Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/src/exception.c	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -9,7 +9,7 @@
 // Author           : Andrew Beach
 // Created On       : Mon Jun 26 15:13:00 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Aug 29 15:52:22 2020
-// Update Count     : 34
+// Last Modified By : Andrew Beach
+// Last Modified On : Tue Oct 27 16:27:00 2020
+// Update Count     : 35
 //
 
@@ -17,12 +17,12 @@
 #include <stddef.h> // for size_t
 
+#include <unwind.h> // for struct _Unwind_Exception {...};
+
 #include "exception.h"
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <unwind.h>
 #include <bits/debug.hfa>
 #include "concurrency/invoke.h"
-#include "concurrency/exception.hfa"
 #include "stdhdr/assert.h"
 
Index: libcfa/src/exception.h
===================================================================
--- libcfa/src/exception.h	(revision 342be435469470dee71cab92b46cf14f8fee7f3a)
+++ libcfa/src/exception.h	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -5,19 +5,25 @@
 // file "LICENCE" distributed with Cforall.
 //
-// exception.h -- Builtins for exception handling.
+// exception.h -- Internal exception handling definitions.
 //
 // Author           : Andrew Beach
 // Created On       : Mon Jun 26 15:11:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue May 19 14:17:00 2020
-// Update Count     : 10
+// Last Modified On : Tue Oct 27 14:45:00 2020
+// Update Count     : 11
 //
 
 #pragma once
 
+// This could be considered several headers. All are internal to the exception
+// system but needed to depending on whether they are C/Cforall code and
+// whether or not they are part of the builtins.
 
 #ifdef __cforall
 extern "C" {
 #endif
+
+// Included in C code or the built-ins.
+#if !defined(__cforall) || defined(__cforall_builtins__)
 
 struct __cfaehm_base_exception_t;
@@ -47,7 +53,7 @@
 // Function catches termination exceptions.
 void __cfaehm_try_terminate(
-    void (*try_block)(),
-    void (*catch_block)(int index, exception_t * except),
-    int (*match_block)(exception_t * except));
+	void (*try_block)(),
+	void (*catch_block)(int index, exception_t * except),
+	int (*match_block)(exception_t * except));
 
 // Clean-up the exception in catch blocks.
@@ -56,20 +62,39 @@
 // Data structure creates a list of resume handlers.
 struct __cfaehm_try_resume_node {
-    struct __cfaehm_try_resume_node * next;
-    _Bool (*handler)(exception_t * except);
+	struct __cfaehm_try_resume_node * next;
+	_Bool (*handler)(exception_t * except);
 };
 
 // These act as constructor and destructor for the resume node.
 void __cfaehm_try_resume_setup(
-    struct __cfaehm_try_resume_node * node,
-    _Bool (*handler)(exception_t * except));
+	struct __cfaehm_try_resume_node * node,
+	_Bool (*handler)(exception_t * except));
 void __cfaehm_try_resume_cleanup(
-    struct __cfaehm_try_resume_node * node);
+	struct __cfaehm_try_resume_node * node);
 
 // Check for a standard way to call fake deconstructors.
 struct __cfaehm_cleanup_hook {};
 
+#endif
+
+// Included in C code and the library.
+#if !defined(__cforall) || !defined(__cforall_builtins__)
+struct __cfaehm_node {
+	struct _Unwind_Exception unwind_exception;
+	struct __cfaehm_node * next;
+	int handler_index;
+};
+
+static inline exception_t * __cfaehm_cancellation_exception(
+		struct _Unwind_Exception * unwind_exception ) {
+	return (exception_t *)(1 + (struct __cfaehm_node *)unwind_exception);
+}
+#endif
+
 #ifdef __cforall
 }
+
+// Built-ins not visible in C.
+#if defined(__cforall_builtins__)
 
 // Not all the built-ins can be expressed in C. These can't be
@@ -124,2 +149,4 @@
 
 #endif
+
+#endif
Index: libcfa/src/stdhdr/unwind.h
===================================================================
--- libcfa/src/stdhdr/unwind.h	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
+++ libcfa/src/stdhdr/unwind.h	(revision c6c682cfa1a2b3a58b9c8cde325953a89154db7a)
@@ -0,0 +1,31 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// unwind.h -- Safely include unwind.h from Cforall.
+//
+// Author           : Andrew Beach
+// Created On       : Wed Oct 28 11:25:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Wed Oct 28 14:11:00 2020
+// Update Count     : 0
+//
+
+#pragma once
+
+extern "C" {
+// This prevents some GCC pragmas that CFA can't handle from being generated.
+#define HIDE_EXPORTS
+
+// Always include the header and use its header guard.
+#include_next <unwind.h>
+
+#undef HIDE_EXPORTS
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
