Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision 433905a9e171762b3a0680e099a6479705f8f04a)
+++ libcfa/src/heap.cfa	(revision 032234bd8cceda07e0b309b3aa2b781de035ca86)
@@ -36,7 +36,7 @@
 static bool traceHeap = false;
 
-inline bool traceHeap() { return traceHeap; }
-
-bool traceHeapOn() {
+inline bool traceHeap() libcfa_public { return traceHeap; }
+
+bool traceHeapOn() libcfa_public {
 	bool temp = traceHeap;
 	traceHeap = true;
@@ -44,5 +44,5 @@
 } // traceHeapOn
 
-bool traceHeapOff() {
+bool traceHeapOff() libcfa_public {
 	bool temp = traceHeap;
 	traceHeap = false;
@@ -50,14 +50,14 @@
 } // traceHeapOff
 
-bool traceHeapTerm() { return false; }
+bool traceHeapTerm() libcfa_public { return false; }
 
 
 static bool prtFree = false;
 
-bool prtFree() {
+static bool prtFree() {
 	return prtFree;
 } // prtFree
 
-bool prtFreeOn() {
+static bool prtFreeOn() {
 	bool temp = prtFree;
 	prtFree = true;
@@ -65,5 +65,5 @@
 } // prtFreeOn
 
-bool prtFreeOff() {
+static bool prtFreeOff() {
 	bool temp = prtFree;
 	prtFree = false;
@@ -388,6 +388,7 @@
 static unsigned int maxBucketsUsed;						// maximum number of buckets in use
 // extern visibility, used by runtime kernel
-size_t __page_size;										// architecture pagesize
-int __map_prot;											// common mmap/mprotect protection
+// would be cool to remove libcfa_public but it's needed for libcfathread
+libcfa_public size_t __page_size;							// architecture pagesize
+libcfa_public int __map_prot;								// common mmap/mprotect protection
 
 
@@ -727,5 +728,5 @@
 
 
-size_t prtFree( Heap & manager ) with( manager ) {
+static size_t prtFree( Heap & manager ) with( manager ) {
 	size_t total = 0;
 	#ifdef __STATISTICS__
@@ -879,5 +880,5 @@
 	// Allocates size bytes and returns a pointer to the allocated memory.  The contents are undefined. If size is 0,
 	// then malloc() returns a unique pointer value that can later be successfully passed to free().
-	void * malloc( size_t size ) {
+	void * malloc( size_t size ) libcfa_public {
 		#ifdef __STATISTICS__
 		if ( likely( size > 0 ) ) {
@@ -894,5 +895,5 @@
 
 	// Same as malloc() except size bytes is an array of dim elements each of elemSize bytes.
-	void * aalloc( size_t dim, size_t elemSize ) {
+	void * aalloc( size_t dim, size_t elemSize ) libcfa_public {
 		size_t size = dim * elemSize;
 		#ifdef __STATISTICS__
@@ -910,5 +911,5 @@
 
 	// Same as aalloc() with memory set to zero.
-	void * calloc( size_t dim, size_t elemSize ) {
+	void * calloc( size_t dim, size_t elemSize ) libcfa_public {
 		size_t size = dim * elemSize;
 	  if ( unlikely( size ) == 0 ) {			// 0 BYTE ALLOCATION RETURNS NULL POINTER
@@ -951,5 +952,5 @@
 	// not 0p, then the call is equivalent to free(oaddr). Unless oaddr is 0p, it must have been returned by an earlier
 	// call to malloc(), alloc(), calloc() or realloc(). If the area pointed to was moved, a free(oaddr) is done.
-	void * resize( void * oaddr, size_t size ) {
+	void * resize( void * oaddr, size_t size ) libcfa_public {
 		// If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
 	  if ( unlikely( size == 0 ) ) {					// special cases
@@ -996,5 +997,5 @@
 	// Same as resize() but the contents are unchanged in the range from the start of the region up to the minimum of
 	// the old and new sizes.
-	void * realloc( void * oaddr, size_t size ) {
+	void * realloc( void * oaddr, size_t size ) libcfa_public {
 		// If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
 	  if ( unlikely( size == 0 ) ) {					// special cases
@@ -1060,5 +1061,5 @@
 
 	// Same as realloc() except the new allocation size is large enough for an array of nelem elements of size elsize.
-	void * reallocarray( void * oaddr, size_t dim, size_t elemSize ) {
+	void * reallocarray( void * oaddr, size_t dim, size_t elemSize ) libcfa_public {
 		return realloc( oaddr, dim * elemSize );
 	} // reallocarray
@@ -1066,5 +1067,5 @@
 
 	// Same as malloc() except the memory address is a multiple of alignment, which must be a power of two. (obsolete)
-	void * memalign( size_t alignment, size_t size ) {
+	void * memalign( size_t alignment, size_t size ) libcfa_public {
 		#ifdef __STATISTICS__
 		if ( likely( size > 0 ) ) {
@@ -1081,5 +1082,5 @@
 
 	// Same as aalloc() with memory alignment.
-	void * amemalign( size_t alignment, size_t dim, size_t elemSize ) {
+	void * amemalign( size_t alignment, size_t dim, size_t elemSize ) libcfa_public {
 		size_t size = dim * elemSize;
 		#ifdef __STATISTICS__
@@ -1097,5 +1098,5 @@
 
 	// Same as calloc() with memory alignment.
-	void * cmemalign( size_t alignment, size_t dim, size_t elemSize ) {
+	void * cmemalign( size_t alignment, size_t dim, size_t elemSize ) libcfa_public {
 		size_t size = dim * elemSize;
 	  if ( unlikely( size ) == 0 ) {					// 0 BYTE ALLOCATION RETURNS NULL POINTER
@@ -1136,5 +1137,5 @@
 	// Same as memalign(), but ISO/IEC 2011 C11 Section 7.22.2 states: the value of size shall be an integral multiple
 	// of alignment. This requirement is universally ignored.
-	void * aligned_alloc( size_t alignment, size_t size ) {
+	void * aligned_alloc( size_t alignment, size_t size ) libcfa_public {
 		return memalign( alignment, size );
 	} // aligned_alloc
@@ -1145,5 +1146,5 @@
 	// is 0, then posix_memalign() returns either 0p, or a unique pointer value that can later be successfully passed to
 	// free(3).
-	int posix_memalign( void ** memptr, size_t alignment, size_t size ) {
+	int posix_memalign( void ** memptr, size_t alignment, size_t size ) libcfa_public {
 	  if ( unlikely( alignment < libAlign() || ! is_pow2( alignment ) ) ) return EINVAL; // check alignment
 		*memptr = memalign( alignment, size );
@@ -1154,5 +1155,5 @@
 	// Allocates size bytes and returns a pointer to the allocated memory. The memory address shall be a multiple of the
 	// page size.  It is equivalent to memalign(sysconf(_SC_PAGESIZE),size).
-	void * valloc( size_t size ) {
+	void * valloc( size_t size ) libcfa_public {
 		return memalign( __page_size, size );
 	} // valloc
@@ -1160,5 +1161,5 @@
 
 	// Same as valloc but rounds size to multiple of page size.
-	void * pvalloc( size_t size ) {
+	void * pvalloc( size_t size ) libcfa_public {
 		return memalign( __page_size, ceiling2( size, __page_size ) ); // round size to multiple of page size
 	} // pvalloc
@@ -1168,5 +1169,5 @@
 	// or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is
 	// 0p, no operation is performed.
-	void free( void * addr ) {
+	void free( void * addr ) libcfa_public {
 	  if ( unlikely( addr == 0p ) ) {					// special case
 			#ifdef __STATISTICS__
@@ -1189,5 +1190,5 @@
 
 	// Returns the alignment of an allocation.
-	size_t malloc_alignment( void * addr ) {
+	size_t malloc_alignment( void * addr ) libcfa_public {
 	  if ( unlikely( addr == 0p ) ) return libAlign();	// minimum alignment
 		Heap.Storage.Header * header = HeaderAddr( addr );
@@ -1201,5 +1202,5 @@
 
 	// Returns true if the allocation is zero filled, e.g., allocated by calloc().
-	bool malloc_zero_fill( void * addr ) {
+	bool malloc_zero_fill( void * addr ) libcfa_public {
 	  if ( unlikely( addr == 0p ) ) return false;		// null allocation is not zero fill
 		Heap.Storage.Header * header = HeaderAddr( addr );
@@ -1212,5 +1213,5 @@
 
 	// Returns original total allocation size (not bucket size) => array size is dimension * sizeof(T).
-	size_t malloc_size( void * addr ) {
+	size_t malloc_size( void * addr ) libcfa_public {
 	  if ( unlikely( addr == 0p ) ) return 0;			// null allocation has zero size
 		Heap.Storage.Header * header = HeaderAddr( addr );
@@ -1224,5 +1225,5 @@
 	// Returns the number of usable bytes in the block pointed to by ptr, a pointer to a block of memory allocated by
 	// malloc or a related function.
-	size_t malloc_usable_size( void * addr ) {
+	size_t malloc_usable_size( void * addr ) libcfa_public {
 	  if ( unlikely( addr == 0p ) ) return 0;			// null allocation has 0 size
 		Heap.Storage.Header * header;
@@ -1236,5 +1237,5 @@
 
 	// Prints (on default standard error) statistics about memory allocated by malloc and related functions.
-	void malloc_stats( void ) {
+	void malloc_stats( void ) libcfa_public {
 		#ifdef __STATISTICS__
 		printStats();
@@ -1245,5 +1246,5 @@
 
 	// Changes the file descriptor where malloc_stats() writes statistics.
-	int malloc_stats_fd( int fd __attribute__(( unused )) ) {
+	int malloc_stats_fd( int fd __attribute__(( unused )) ) libcfa_public {
 		#ifdef __STATISTICS__
 		int temp = stats_fd;
@@ -1259,5 +1260,5 @@
 	// The string is printed on the file stream stream.  The exported string includes information about all arenas (see
 	// malloc).
-	int malloc_info( int options, FILE * stream __attribute__(( unused )) ) {
+	int malloc_info( int options, FILE * stream __attribute__(( unused )) ) libcfa_public {
 	  if ( options != 0 ) { errno = EINVAL; return -1; }
 		#ifdef __STATISTICS__
@@ -1271,5 +1272,5 @@
 	// Adjusts parameters that control the behaviour of the memory-allocation functions (see malloc). The param argument
 	// specifies the parameter to be modified, and value specifies the new value for that parameter.
-	int mallopt( int option, int value ) {
+	int mallopt( int option, int value ) libcfa_public {
 	  if ( value < 0 ) return 0;
 		choose( option ) {
@@ -1285,5 +1286,5 @@
 
 	// Attempt to release free memory at the top of the heap (by calling sbrk with a suitable argument).
-	int malloc_trim( size_t ) {
+	int malloc_trim( size_t ) libcfa_public {
 		return 0;										// => impossible to release memory
 	} // malloc_trim
@@ -1294,5 +1295,5 @@
 	// structure dynamically allocated via malloc, and a pointer to that data structure is returned as the function
 	// result.  (The caller must free this memory.)
-	void * malloc_get_state( void ) {
+	void * malloc_get_state( void ) libcfa_public {
 		return 0p;										// unsupported
 	} // malloc_get_state
@@ -1301,5 +1302,5 @@
 	// Restores the state of all malloc internal bookkeeping variables to the values recorded in the opaque data
 	// structure pointed to by state.
-	int malloc_set_state( void * ) {
+	int malloc_set_state( void * ) libcfa_public {
 		return 0;										// unsupported
 	} // malloc_set_state
@@ -1307,16 +1308,16 @@
 
 	// Sets the amount (bytes) to extend the heap when there is insufficent free storage to service an allocation.
-	__attribute__((weak)) size_t malloc_expansion() { return __CFA_DEFAULT_HEAP_EXPANSION__; }
+	__attribute__((weak)) size_t malloc_expansion() libcfa_public { return __CFA_DEFAULT_HEAP_EXPANSION__; }
 
 	// Sets the crossover point between allocations occuring in the sbrk area or separately mmapped.
-	__attribute__((weak)) size_t malloc_mmap_start() { return __CFA_DEFAULT_MMAP_START__; }
+	__attribute__((weak)) size_t malloc_mmap_start() libcfa_public { return __CFA_DEFAULT_MMAP_START__; }
 
 	// Amount subtracted to adjust for unfreed program storage (debug only).
-	__attribute__((weak)) size_t malloc_unfreed() { return __CFA_DEFAULT_HEAP_UNFREED__; }
+	__attribute__((weak)) size_t malloc_unfreed() libcfa_public { return __CFA_DEFAULT_HEAP_UNFREED__; }
 } // extern "C"
 
 
 // Must have CFA linkage to overload with C linkage realloc.
-void * resize( void * oaddr, size_t nalign, size_t size ) {
+void * resize( void * oaddr, size_t nalign, size_t size ) libcfa_public {
 	// If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
   if ( unlikely( size == 0 ) ) {						// special cases
@@ -1380,5 +1381,5 @@
 
 
-void * realloc( void * oaddr, size_t nalign, size_t size ) {
+void * realloc( void * oaddr, size_t nalign, size_t size ) libcfa_public {
 	// If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.
   if ( unlikely( size == 0 ) ) {						// special cases
