Index: /trunk/nv/core/common.hh
===================================================================
--- /trunk/nv/core/common.hh	(revision 375)
+++ /trunk/nv/core/common.hh	(revision 376)
@@ -4,5 +4,4 @@
 // This file is part of NV Libraries.
 // For conditions of distribution and use, see copyright notice in nv.hh
-
 #ifndef NV_CORE_COMMON_HH
 #define NV_CORE_COMMON_HH
@@ -68,5 +67,5 @@
 
 // Platform specific settings.
-#if NV_PLATFORM == NV_WINDOWS
+#if NV_COMPILER == NV_MSVC
 #ifdef _DEBUG
 #define NV_DEBUG 1
@@ -74,11 +73,9 @@
 #define NV_DEBUG 0
 #endif
-#endif
-
-#if NV_PLATFORM == NV_LINUX || NV_PLATFORM == NV_APPLE
-#ifdef DEBUG
+#else
+#ifdef NDEBUG
+#define NV_DEBUG 0
+#else
 #define NV_DEBUG 1
-#else
-#define NV_DEBUG 0
 #endif
 #endif
@@ -105,6 +102,6 @@
 #endif
 
-#if NV_COMPILER == NV_GNUC && NV_COMP_VER < 460
-#error "GCC 4.6+ required!"
+#if NV_COMPILER == NV_GNUC && NV_COMP_VER < 480
+#error "GCC 4.8+ required!"
 #endif
 
@@ -125,8 +122,11 @@
 #endif
 
-#include <cassert>
-
 #define NV_STRINGIZE_DETAIL(x) #x
 #define NV_STRINGIZE(x) NV_STRINGIZE_DETAIL(x)
+
+#if NV_COMPILER == NV_MSVC
+#define NV_WIDE_DETAIL(x) L ## x
+#define NV_WIDE(x) NV_WIDE_DETAIL(x)
+#endif
 
 #if NV_COMPILER == NV_MSVC
@@ -134,8 +134,14 @@
 #define NV_ALIGN(value) __declspec(align(value))
 #define NV_ALIGNED_STRUCT(value) __declspec(align(value)) struct
+#define NV_NOALIAS __declspec(noalias)
 #define NV_RESTRICT __declspec(restrict)
 #define NV_RESTRICT_VAR __restrict
 #define NV_NOEXCEPT throw()
 #define NV_ALIGN_OF(type) __alignof(type)
+#if NV_ARCHITECTURE == NV_64BIT
+#define NV_OFFSET_OF(obj,m) (nv::size_t)( (nv::ptrdiff_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m)) )
+#else // NV_32BIT
+#define NV_OFFSET_OF(obj,m) (nv::size_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m))
+#endif  
 //#define NV_CONSTEXPR 
 #elif NV_COMPILER == NV_GNUC || NV_COMPILER == NV_CLANG
@@ -147,18 +153,11 @@
 #define NV_NOEXCEPT noexcept
 #define NV_ALIGN_OF(type) alignof(type)
+#define NV_OFFSET_OF(obj, m) __builtin_offsetof(obj, m)
 //#define NV_CONSTEXPR constexpr 
 #else
-#define NV_DEPRECATED(func) func
-#define NV_ALIGN(value)
-#define NV_ALIGNED_STRUCT(value) struct 
-#define NV_RESTRICT
-#define NV_RESTRICT_VAR
-#define NV_NOEXCEPT 
-#define NV_ALIGN_OF
-//#define NV_CONSTEXPR 
+#error "Unknown compiler, cannot proceed!"
 #endif 
 
 #define NV_UNUSED(x) (void)(x)
-#define NV_ASSERT(cond, msg) assert( (cond) && msg )
 #define NV_THROW(eobj, ...) { \
 	NV_LOG_ERROR( __FILE__ " line " NV_STRINGIZE(__LINE__) " - exception thrown - " #eobj ); \
@@ -184,6 +183,8 @@
 	}
 
-	using ::size_t; // typedef decltype( sizeof( int ) ) size_t;
-	using ::ptrdiff_t;
+	using size_t    = decltype( sizeof(0) );
+	using ptrdiff_t = decltype((int*)0 - (int*)0);
+
+	using nullptr_t = decltype( nullptr );
 
 	// Typedefs for fixed size types.
@@ -196,11 +197,7 @@
 	typedef unsigned int       uint32;
 
-#if NV_COMPILER == NV_MSVC
-	typedef signed   __int64   sint64;
-	typedef unsigned __int64   uint64;
-#else
 	typedef signed   long long sint64;
 	typedef unsigned long long uint64;
-#endif
+
 	typedef unsigned char      uchar8;
 	typedef unsigned short     uchar16;
@@ -242,9 +239,14 @@
 		typedef T value_type;
 		typedef integral_constant<T, VALUE> type;
-		NV_CONSTEXPR operator value_type() const { return ( value ); }
-	};
-
-	typedef integral_constant<bool, true> true_type;
-	typedef integral_constant<bool, false> false_type;
+		NV_CONSTEXPR operator value_type() const NV_NOEXCEPT { return ( value ); }
+		NV_CONSTEXPR value_type operator()() const NV_NOEXCEPT { return value; }
+	};
+
+	// TODO: Propagate
+	template< bool B >
+	using bool_constant = integral_constant < bool, B > ;
+
+	typedef bool_constant<true> true_type;
+	typedef bool_constant<false> false_type;
 
 	template< bool TEST, typename T = void>
@@ -313,4 +315,6 @@
 static_assert( sizeof( nv::f64 ) == 8, "float64 size isn't 8 bytes" );
 
+#include <nv/stl/assert.hh>
 
 #endif // NV_CORE_COMMON_HH
+
Index: /trunk/nv/interface/animation_key.hh
===================================================================
--- /trunk/nv/interface/animation_key.hh	(revision 375)
+++ /trunk/nv/interface/animation_key.hh	(revision 376)
@@ -120,5 +120,5 @@
 			typedef decltype( KEY::time ) value_type;
 			static const datatype etype  = type_to_enum< decltype( KEY::time ) >::type;
-			static const int      offset = offsetof( KEY, time );
+			static const int      offset = NV_OFFSET_OF( KEY, time );
 		};
 
@@ -128,5 +128,5 @@
 			typedef decltype( KEY::position ) value_type;
 			static const datatype etype  = type_to_enum< decltype( KEY::position ) >::type;
-			static const int      offset = offsetof( KEY, position );
+			static const int      offset = NV_OFFSET_OF( KEY, position );
 			static void interpolate( KEY& key, const KEY& k1, const KEY& k2, float factor )
 			{
@@ -140,5 +140,5 @@
 			typedef decltype( KEY::rotation ) value_type;
 			static const datatype etype  = type_to_enum< decltype( KEY::rotation ) >::type;
-			static const int      offset = offsetof( KEY, rotation );
+			static const int      offset = NV_OFFSET_OF( KEY, rotation );
 			static void interpolate( KEY& key, const KEY& k1, const KEY& k2, float factor )
 			{
@@ -152,5 +152,5 @@
 			typedef decltype( KEY::scale ) value_type;
 			static const datatype etype  = type_to_enum< decltype( KEY::scale ) >::type;
-			static const int      offset = offsetof( KEY, scale );
+			static const int      offset = NV_OFFSET_OF( KEY, scale );
 			static void interpolate( KEY& key, const KEY& k1, const KEY& k2, float factor )
 			{
@@ -164,5 +164,5 @@
 			typedef decltype( KEY::tform ) value_type;
 			static const datatype etype  = type_to_enum< decltype( KEY::tform ) >::type;
-			static const int      offset = offsetof( KEY, tform );
+			static const int      offset = NV_OFFSET_OF( KEY, tform );
 			static void interpolate( KEY& key, const KEY& k1, const KEY& k2, float factor )
 			{
@@ -173,5 +173,5 @@
 
 	template < typename KEY, animation_slot SLOT >
-	struct key_has_slot : public detail::key_has_slot_impl< KEY, SLOT >
+	struct key_has_slot : bool_constant< detail::key_has_slot_impl< KEY, SLOT >::value >
 	{
 	};
Index: /trunk/nv/interface/interpolation_template.hh
===================================================================
--- /trunk/nv/interface/interpolation_template.hh	(revision 375)
+++ /trunk/nv/interface/interpolation_template.hh	(revision 376)
@@ -32,8 +32,8 @@
 	void interpolate_key( KEY& key, const KEY& k1, const KEY& k2, float factor )
 	{
-		interpolate_slot< KEY, animation_slot::POSITION >( key, k1, k2, factor, integral_constant< bool, key_has_slot< KEY, animation_slot::POSITION >::value >() );
-		interpolate_slot< KEY, animation_slot::ROTATION >( key, k1, k2, factor, integral_constant< bool, key_has_slot< KEY, animation_slot::ROTATION >::value >() );
-		interpolate_slot< KEY, animation_slot::SCALE >( key, k1, k2, factor, integral_constant< bool, key_has_slot< KEY, animation_slot::SCALE >::value >() );
-		interpolate_slot< KEY, animation_slot::TFORM >( key, k1, k2, factor, integral_constant< bool, key_has_slot< KEY, animation_slot::TFORM >::value >() );
+		interpolate_slot< KEY, animation_slot::POSITION >( key, k1, k2, factor, key_has_slot< KEY, animation_slot::POSITION >() );
+		interpolate_slot< KEY, animation_slot::ROTATION >( key, k1, k2, factor, key_has_slot< KEY, animation_slot::ROTATION >() );
+		interpolate_slot< KEY, animation_slot::SCALE >( key, k1, k2, factor, key_has_slot< KEY, animation_slot::SCALE >() );
+		interpolate_slot< KEY, animation_slot::TFORM >( key, k1, k2, factor, key_has_slot< KEY, animation_slot::TFORM >() );
 	}
 
@@ -135,7 +135,7 @@
 			static_assert( key_has_slot< KEY, animation_slot::TFORM >::value == false, "key!");
 			return extract_matrix_prs( k,
-				integral_constant< bool, key_has_slot< KEY, animation_slot::POSITION >::value >(),
-				integral_constant< bool, key_has_slot< KEY, animation_slot::ROTATION >::value >(),
-				integral_constant< bool, key_has_slot< KEY, animation_slot::SCALE >::value >()
+				key_has_slot< KEY, animation_slot::POSITION >(),
+				key_has_slot< KEY, animation_slot::ROTATION >(),
+				key_has_slot< KEY, animation_slot::SCALE >()
 				);
 		}
@@ -156,6 +156,6 @@
 			static_assert( key_has_slot< KEY, animation_slot::SCALE >::value == false, "key!");
 			return extract_transform_pr_impl( k, 
-				integral_constant< bool, key_has_slot< KEY, animation_slot::POSITION >::value >(),
-				integral_constant< bool, key_has_slot< KEY, animation_slot::ROTATION >::value >() 
+				key_has_slot< KEY, animation_slot::POSITION >::value >(),
+				key_has_slot< KEY, animation_slot::ROTATION >::value >()
 				);
 		}
@@ -165,5 +165,5 @@
 	mat4 extract_matrix( const KEY& k )
 	{
-		return detail::extract_matrix_impl( k, integral_constant< bool, key_has_slot< KEY, animation_slot::TFORM >::value >() );
+		return detail::extract_matrix_impl( k, key_has_slot< KEY, animation_slot::TFORM >() );
 	}
 
@@ -171,5 +171,5 @@
 	transform extract_transform( const KEY& k )
 	{
-		return detail::extract_transform_impl( k, integral_constant< bool, key_has_slot< KEY, animation_slot::TFORM >::value >() );
+		return detail::extract_transform_impl( k, key_has_slot< KEY, animation_slot::TFORM >() );
 	}
 
Index: /trunk/nv/interface/vertex.hh
===================================================================
--- /trunk/nv/interface/vertex.hh	(revision 375)
+++ /trunk/nv/interface/vertex.hh	(revision 376)
@@ -164,5 +164,5 @@
 			typedef decltype( VT::position ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::position ) >::type;
-			static const int      offset = offsetof( VT, position );
+			static const int      offset = NV_OFFSET_OF( VT, position );
 		};
 
@@ -172,5 +172,5 @@
 			typedef decltype( VT::texcoord ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::texcoord ) >::type;
-			static const int      offset = offsetof( VT, texcoord );
+			static const int      offset = NV_OFFSET_OF( VT, texcoord );
 		};
 
@@ -180,5 +180,5 @@
 			typedef decltype( VT::normal ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::normal ) >::type;
-			static const int      offset = offsetof( VT, normal );
+			static const int      offset = NV_OFFSET_OF( VT, normal );
 		};
 
@@ -188,5 +188,5 @@
 			typedef decltype( VT::tangent ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::tangent ) >::type;
-			static const int      offset = offsetof( VT, tangent );
+			static const int      offset = NV_OFFSET_OF( VT, tangent );
 		};
 
@@ -196,5 +196,5 @@
 			typedef decltype( VT::boneindex ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::boneindex ) >::type;
-			static const int      offset = offsetof( VT, boneindex );
+			static const int      offset = NV_OFFSET_OF( VT, boneindex );
 		};
 
@@ -204,5 +204,5 @@
 			typedef decltype( VT::boneweight ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::boneweight ) >::type;
-			static const int      offset = offsetof( VT, boneweight );
+			static const int      offset = NV_OFFSET_OF( VT, boneweight );
 		};
 
@@ -212,5 +212,5 @@
 			typedef decltype( VT::color ) value_type;
 			static const datatype etype  = type_to_enum< decltype( VT::color ) >::type;
-			static const int      offset = offsetof( VT, color );
+			static const int      offset = NV_OFFSET_OF( VT, color );
 		};
 
Index: /trunk/nv/lib/curses.hh
===================================================================
--- /trunk/nv/lib/curses.hh	(revision 375)
+++ /trunk/nv/lib/curses.hh	(revision 376)
@@ -29,4 +29,6 @@
 #endif
 
+// for va_list
+#include <stdarg.h>
 #ifdef CURSES_PDC_WIDE
 #include <wchar.h>
Index: /trunk/nv/lib/detail/wgl_functions.inc
===================================================================
--- /trunk/nv/lib/detail/wgl_functions.inc	(revision 375)
+++ /trunk/nv/lib/detail/wgl_functions.inc	(revision 376)
@@ -12,5 +12,6 @@
 NV_GL_FUN_REN( BOOL,  wglRealizeLayerPalette,   dynwglRealizeLayerPalette,(HDC, int, BOOL) );
 NV_GL_FUN_REN( BOOL,  wglSwapLayerBuffers,      dynwglSwapLayerBuffers, (HDC, UINT) );
-NV_GL_FUN_REN( DWORD, wglSwapMultipleBuffers,   dynwglSwapMultipleBuffers, (UINT, CONST WGLSWAP *) );
+// GCC 4.8 doesnt like WGLSWAP
+//NV_GL_FUN_REN( DWORD, wglSwapMultipleBuffers,   dynwglSwapMultipleBuffers, (UINT, CONST WGLSWAP *) );
 
 // Global
Index: /trunk/nv/stl/algorithm.hh
===================================================================
--- /trunk/nv/stl/algorithm.hh	(revision 375)
+++ /trunk/nv/stl/algorithm.hh	(revision 376)
@@ -219,5 +219,5 @@
 	{
 		detail::fill_impl( first, last, value,
-			integral_constant< bool, sizeof( T ) == 1 && has_trivial_assign<T>::value >() );
+			bool_constant< sizeof( T ) == 1 && has_trivial_assign<T>::value >() );
 	}
 
@@ -226,5 +226,5 @@
 	{
 		return detail::fill_n_impl( first, count, value,
-			integral_constant< bool, sizeof( T ) == 1 && has_trivial_assign<T>::value >() );
+			bool_constant< sizeof( T ) == 1 && has_trivial_assign<T>::value >() );
 	}
 
@@ -235,5 +235,5 @@
 		typedef typename iterator_traits< ForwardIterator >::value_type value_type;
 		detail::fill_impl( first, last, value_type(),
-			integral_constant< bool, sizeof( value_type ) == 1 && has_trivial_assign<value_type>::value >() );
+			bool_constant< sizeof( value_type ) == 1 && has_trivial_assign<value_type>::value >() );
 	}
 
@@ -244,5 +244,5 @@
 		typedef typename iterator_traits< ForwardIterator >::value_type value_type;
 		return detail::fill_n_impl( first, count, value_type(),
-			integral_constant< bool, sizeof( value_type ) == 1 && has_trivial_assign<value_type>::value >() );
+			bool_constant< sizeof( value_type ) == 1 && has_trivial_assign<value_type>::value >() );
 	}
 
Index: /trunk/nv/stl/array.hh
===================================================================
--- /trunk/nv/stl/array.hh	(revision 375)
+++ /trunk/nv/stl/array.hh	(revision 376)
@@ -84,12 +84,7 @@
 	};
 
-	// TODO: using array =
 	template< typename T, size_t N >
-	class array : public array_base< T, 
-		fixed_container_storage< static_storage< T, N > >
-	>
-	{
-
-	};
+	using array = array_base < T, fixed_container_storage < static_storage< T, N > > >;
+	
 
 #if 0
Index: /trunk/nv/stl/assert.hh
===================================================================
--- /trunk/nv/stl/assert.hh	(revision 376)
+++ /trunk/nv/stl/assert.hh	(revision 376)
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+* @file assert.hh
+* @author Kornel Kisielewicz
+* @brief Assert functions
+*/
+
+#ifndef NV_CORE_COMMON_HH
+#error "Do not include assert.hh directly, inlcude nv/core/common.hh"
+#endif
+
+#ifndef NV_STL_ASSERT_HH
+#define NV_STL_ASSERT_HH
+
+#ifdef NV_INTERNAL_INCLUDE
+#undef NV_CORE_COMMON_HH
+#include <nv/core/common.hh>
+#endif
+
+#if NV_COMPILER == NV_MSVC
+void nv_internal_assert( const wchar_t * message, const wchar_t* file, unsigned line );
+#	if NV_DEBUG
+#	define NV_ASSERT_IMPL(cond) (void)( (!!(cond)) || (nv_internal_assert(NV_WIDE(#cond), NV_WIDE(__FILE__), __LINE__), 0) )
+#	else
+#	define NV_ASSERT_IMPL(cond) 
+#	endif
+#else
+void nv_internal_assert( const char * assertion, const char * file, unsigned int line, const char * function );
+#	if NV_DEBUG
+#	define NV_ASSERT_IMPL(cond) ((cond) ? static_cast<void>(0) : nv_internal_assert(NV_STRINGIZE(cond), __FILE__, __LINE__, __PRETTY_FUNCTION__))
+#	else
+#	define NV_ASSERT_IMPL(cond) 
+#	endif
+#endif
+
+#if NV_DEBUG
+#define NV_ASSERT(cond, msg) NV_ASSERT_IMPL( (cond) && "assertion failed:" msg )
+#else  
+#define NV_ASSERT(cond, msg)     ((void)0)
+#endif 
+
+#endif // NV_STL_ASSERT_HH
Index: /trunk/nv/stl/capi.hh
===================================================================
--- /trunk/nv/stl/capi.hh	(revision 376)
+++ /trunk/nv/stl/capi.hh	(revision 376)
@@ -0,0 +1,65 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+* @file capi.hh
+* @author Kornel Kisielewicz
+* @brief C API functions
+*
+* This header is temporary
+*/
+
+#ifndef NV_STL_CAPI_HH
+#define NV_STL_CAPI_HH
+
+#include <nv/core/common.hh>
+
+#if NV_COMPILER == NV_MSVC
+extern "C" {
+	NV_NOALIAS NV_RESTRICT void * __cdecl calloc( size_t _Count, size_t _Size );
+	NV_NOALIAS             void   __cdecl free( void * _Memory );
+	NV_NOALIAS NV_RESTRICT void * __cdecl malloc( size_t );
+	NV_NOALIAS NV_RESTRICT void * __cdecl realloc( void * _Memory, size_t _NewSize );
+}
+#endif 
+// TODO: remove when clang 3.5 will be used (with builtins)
+#if NV_COMPILER == NV_CLANG
+extern "C" {
+	extern void * calloc( nv::size_t, nv::size_t );
+	extern void   free( void * );
+	extern void * malloc( nv::size_t );
+	extern void * realloc( void * , nv::size_t );
+}
+#endif
+
+namespace nv
+{
+	inline void* nvmalloc( size_t size )
+	{
+#if NV_COMPILER == NV_MSVC
+		return malloc( size );
+#elif NV_COMPILER == NV_CLANG
+		return malloc( size );
+		//		return __builtin_operator_new( size );
+#else
+		return __builtin_malloc( size );
+#endif
+	}
+	inline void nvfree( void* p )
+	{
+#if NV_COMPILER == NV_MSVC
+		free( p );
+#elif NV_COMPILER == NV_CLANG
+		free( p );
+		//		__builtin_operator_delete( p );
+#else
+		__builtin_free( p );
+#endif
+	}
+
+}
+
+#endif // NV_STL_CAPI_HH
Index: /trunk/nv/stl/handle.hh
===================================================================
--- /trunk/nv/stl/handle.hh	(revision 375)
+++ /trunk/nv/stl/handle.hh	(revision 376)
@@ -93,7 +93,6 @@
 		{
 			value_type index = h.index();
-			typedef handle_operator<HANDLE> hop;
 			NV_ASSERT( m_entries[index].next_free == USED, "Unused handle freed!" );
-			NV_ASSERT( m_entries[index].counter == hop::get_counter( h ), "Handle corruption!" );
+			NV_ASSERT( m_entries[index].counter == handle_operator<HANDLE>::get_counter( h ), "Handle corruption!" );
 			m_entries[index].next_free = NONE;
 			if ( m_last_free == NONE )
Index: /trunk/nv/stl/limits.hh
===================================================================
--- /trunk/nv/stl/limits.hh	(revision 375)
+++ /trunk/nv/stl/limits.hh	(revision 376)
@@ -47,10 +47,10 @@
 		static const signed long sl_max = 2147483647;
 		static const signed long sl_bit = sizeof( signed long ) * 8;
-		static const uint64 ull_min = 0;
-		static const uint64 ull_max = 18446744073709551615;
-		static const uint64 ull_bit = sizeof( uint64 ) * 8;
-		static const sint64 sll_min = -9223372036854775808;
-		static const sint64 sll_max = 9223372036854775807;
-		static const sint64 sll_bit = sizeof( sint64 ) * 8;
+		static const unsigned long long ull_min = 0;
+		static const unsigned long long ull_max = 18446744073709551615;
+		static const unsigned long long ull_bit = sizeof( unsigned long long ) * 8;
+		static const signed long long sll_min = -9223372036854775808;
+		static const signed long long sll_max = 9223372036854775807;
+		static const signed long long sll_bit = sizeof( signed long long ) * 8;
 
 		static const int f_dig        = 6;
@@ -311,11 +311,11 @@
 
 	template<>
-	struct numeric_limits < uint64 > : detail::numeric_limits_int_base
-	{
-		static NV_CONSTEXPR uint64 min()           NV_NOEXCEPT { return limits::ull_min; }
-		static NV_CONSTEXPR uint64 max()           NV_NOEXCEPT { return limits::ull_max; }
-		static NV_CONSTEXPR uint64 lowest()        NV_NOEXCEPT { return limits::ull_min; }
-		static NV_CONSTEXPR uint64 epsilon()       NV_NOEXCEPT { return 0; }
-		static NV_CONSTEXPR uint64 round_error()   NV_NOEXCEPT { return 0; }
+	struct numeric_limits < unsigned long long > : detail::numeric_limits_int_base
+	{
+		static NV_CONSTEXPR unsigned long long min()           NV_NOEXCEPT { return limits::ull_min; }
+		static NV_CONSTEXPR unsigned long long max()           NV_NOEXCEPT{ return limits::ull_max; }
+		static NV_CONSTEXPR unsigned long long lowest()        NV_NOEXCEPT{ return limits::ull_min; }
+		static NV_CONSTEXPR unsigned long long epsilon()       NV_NOEXCEPT{ return 0; }
+		static NV_CONSTEXPR unsigned long long round_error()   NV_NOEXCEPT{ return 0; }
 
 		static const bool is_signed = false;
@@ -325,11 +325,11 @@
 
 	template<>
-	struct numeric_limits < sint64 > : detail::numeric_limits_int_base
-	{
-		static NV_CONSTEXPR sint64 min()           NV_NOEXCEPT { return limits::sll_min; }
-		static NV_CONSTEXPR sint64 max()           NV_NOEXCEPT { return limits::sll_max; }
-		static NV_CONSTEXPR sint64 lowest()        NV_NOEXCEPT { return limits::sll_min; }
-		static NV_CONSTEXPR sint64 epsilon()       NV_NOEXCEPT { return 0; }
-		static NV_CONSTEXPR sint64 round_error()   NV_NOEXCEPT { return 0; }
+	struct numeric_limits < signed long long > : detail::numeric_limits_int_base
+	{
+		static NV_CONSTEXPR signed long long min()           NV_NOEXCEPT{ return limits::sll_min; }
+		static NV_CONSTEXPR signed long long max()           NV_NOEXCEPT{ return limits::sll_max; }
+		static NV_CONSTEXPR signed long long lowest()        NV_NOEXCEPT{ return limits::sll_min; }
+		static NV_CONSTEXPR signed long long epsilon()       NV_NOEXCEPT{ return 0; }
+		static NV_CONSTEXPR signed long long round_error()   NV_NOEXCEPT{ return 0; }
 
 		static const bool is_signed = true;
Index: /trunk/nv/stl/memory.hh
===================================================================
--- /trunk/nv/stl/memory.hh	(revision 375)
+++ /trunk/nv/stl/memory.hh	(revision 376)
@@ -20,9 +20,9 @@
 #include <nv/stl/utility.hh>
 #include <nv/stl/iterator.hh>
-
-#include <type_traits>
+#include <nv/stl/capi.hh>
 
 namespace nv
 {
+
 	template< typename T >
 	class storage_view
@@ -111,9 +111,9 @@
 		fixed_dynamic_storage()
 		{
-			m_data = malloc( N * sizeof( value_type ) );
+			m_data = nvmalloc( N * sizeof( value_type ) );
 		}
 		~fixed_dynamic_storage()
 		{
-			free( m_data );
+			nvfree( m_data );
 		}
 		static NV_CONSTEXPR size_t capacity() { return N; }
Index: /trunk/nv/stl/string.hh
===================================================================
--- /trunk/nv/stl/string.hh	(revision 375)
+++ /trunk/nv/stl/string.hh	(revision 376)
@@ -283,20 +283,12 @@
 	}
 
-#if NV_COMPILER == NV_GNUC
-	template< typename T >
-	struct string_length : public detail::string_length_impl <
-		typename remove_cv < typename remove_reference< T >::type >::type >
-	{
-	};
-#else
 	template< typename T >
 	using string_length = detail::string_length_impl <
 		typename remove_cv < typename remove_reference< T >::type >::type >;
-#endif
 
 	// These could be done much better
 	template <typename T>
 	struct is_cstring
-		: public integral_constant < bool,
+		: bool_constant < 
 		is_same<       char *, typename decay< T >::type >::value ||
 		is_same< const char *, typename decay< T >::type >::value >
@@ -306,11 +298,9 @@
 	template <typename T>
 	struct is_stdstring
-		: public integral_constant < bool,
-		is_same< std::string, typename remove_cvr< T >::type >::value
-		>
-	{
-	};
-
-	template < typename T > struct is_string : public integral_constant < bool, is_stdstring<T>::value || is_cstring<T>::value > {};
+		: bool_constant < is_same< std::string, typename remove_cvr< T >::type >::value >
+	{
+	};
+
+	template < typename T > struct is_string : bool_constant < is_stdstring<T>::value || is_cstring<T>::value > {};
 
 	template<typename T>
Index: /trunk/nv/stl/type_traits.hh
===================================================================
--- /trunk/nv/stl/type_traits.hh	(revision 375)
+++ /trunk/nv/stl/type_traits.hh	(revision 376)
@@ -12,4 +12,5 @@
 // TODO: remove typeinfo?
 
+
 #ifndef NV_STL_TYPE_TRAITS_HH
 #define NV_STL_TYPE_TRAITS_HH
@@ -17,5 +18,4 @@
 #include <nv/core/common.hh>
 
-#include <type_traits>
 namespace nv
 {
@@ -244,6 +244,6 @@
 		template<> struct is_integral_impl< signed long > : true_type {};
 		template<> struct is_integral_impl< unsigned long > : true_type {};
-		template<> struct is_integral_impl< sint64 > : true_type {};
-		template<> struct is_integral_impl< uint64 > : true_type {};
+		template<> struct is_integral_impl< signed long long > : true_type{};
+		template<> struct is_integral_impl< unsigned long long > : true_type{};
 
 		template< typename T > struct is_floating_point_impl : false_type {};
@@ -264,5 +264,5 @@
 		template<> struct signed_type < unsigned int > { typedef signed int type; };
 		template<> struct signed_type < unsigned long > { typedef signed long type; };
-		template<> struct signed_type < uint64 > { typedef sint64 type; };
+		template<> struct signed_type < unsigned long long > { typedef signed long long type; };
 
 		template < typename T >
@@ -277,5 +277,5 @@
 		template<> struct unsigned_type < signed int > { typedef unsigned int type; };
 		template<> struct unsigned_type < signed long > { typedef unsigned long type; };
-		template<> struct unsigned_type < sint64 > { typedef uint64 type; };
+		template<> struct unsigned_type < signed long long > { typedef unsigned long long type; };
 
 		template < typename T, bool IS_ENUM = is_enum< T >::value >
@@ -340,6 +340,6 @@
 	template <> struct is_signed<signed long> : true_type {};
 	template <> struct is_signed<const signed long> : true_type {};
-	template <> struct is_signed<sint64> : true_type {};
-	template <> struct is_signed<const sint64> : true_type{};
+	template <> struct is_signed<signed long long> : true_type{};
+	template <> struct is_signed<const signed long long> : true_type{};
 
 	template <typename T> struct is_unsigned : false_type {};
@@ -353,6 +353,6 @@
 	template <> struct is_unsigned<unsigned long> : true_type{};
 	template <> struct is_unsigned<const unsigned long> : true_type{};
-	template <> struct is_unsigned<uint64> : true_type{};
-	template <> struct is_unsigned<const uint64> : true_type{};
+	template <> struct is_unsigned<unsigned long long> : true_type{};
+	template <> struct is_unsigned<const unsigned long long> : true_type{};
 
 	template <> struct is_signed<char> : integral_constant<bool, ( char( 0 ) > char( -1 ) ) >{};
@@ -618,5 +618,5 @@
 		long double             dummy1;
 		void*                   dummy2;
-		sint64                  dummy3;
+		long long               dummy3;
 		detail::aligned_fptr    dummy4;
 		detail::aligned_memptr  dummy5;
Index: /trunk/src/core/logger.cc
===================================================================
--- /trunk/src/core/logger.cc	(revision 375)
+++ /trunk/src/core/logger.cc	(revision 376)
@@ -8,5 +8,5 @@
 #include "nv/core/time.hh"
 #include <cstdio>
-#if NV_PLATFORM == NV_WINDOWS
+#if NV_COMPILER == NV_MSVC 
 #define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
@@ -51,5 +51,5 @@
 #define NV_LOG_LEVEL_NAME_PAD(level) (log_level_names_pad[ (level) / 10 ])
 
-#if NV_PLATFORM == NV_WINDOWS 
+#if NV_COMPILER == NV_MSVC 
 static unsigned short log_color[] =
 {
@@ -145,5 +145,5 @@
 	size_t ssize = timestamp( stamp );
 
-#if NV_PLATFORM == NV_WINDOWS 
+#if NV_COMPILER == NV_MSVC 
 	if ( m_color ) SetConsoleTextAttribute( m_handle, FOREGROUND_INTENSITY );
 	WriteConsole( m_handle, stamp, ssize, nullptr, nullptr );
@@ -170,5 +170,5 @@
 	else
 		fwrite( "] ", 2, 1, stdout );
-	fwrite( stamp.data(), stamp.size(), 1, stdout );
+	fwrite( message.data(), message.size(), 1, stdout );
 	fwrite( "\n", 1, 1, stdout );
 #endif
@@ -233,5 +233,5 @@
 	: m_color( coloring )
 {
-#if NV_PLATFORM == NV_WINDOWS 
+#if NV_COMPILER == NV_MSVC 
 	m_handle = GetStdHandle( STD_OUTPUT_HANDLE );
 #else
@@ -240,5 +240,5 @@
 }
 
-size_t nv::log_sink::timestamp( char* buffer ) const
+nv::size_t nv::log_sink::timestamp( char* buffer ) const
 {
 	uint32 ms = get_system_ms();
@@ -248,5 +248,5 @@
 	unsigned int m    = (unsigned int)(secs / 60) % 60;
 	unsigned int s    = secs % 60;
-#if NV_PLATFORM == NV_WINDOWS 
+#if NV_COMPILER == NV_MSVC 
 	sprintf_s( buffer, 16, "%02d:%02d:%02d.%02d", h, m, s, mm );
 #else
Index: /trunk/src/core/profiler.cc
===================================================================
--- /trunk/src/core/profiler.cc	(revision 375)
+++ /trunk/src/core/profiler.cc	(revision 376)
@@ -12,5 +12,5 @@
 using namespace nv;
 
-#ifdef NV_MSVC
+#if NV_COMPILER == NV_MSVC
 #define snprintf sprintf_s
 #endif
Index: /trunk/src/core/time.cc
===================================================================
--- /trunk/src/core/time.cc	(revision 375)
+++ /trunk/src/core/time.cc	(revision 376)
@@ -7,4 +7,6 @@
 #include "nv/core/logging.hh"
 
+#include <ctime>
+
 #if NV_COMPILER == NV_MSVC
 #define WIN32_LEAN_AND_MEAN 
@@ -13,9 +15,18 @@
 #pragma intrinsic(__rdtsc)
 #else
-#include <unistd.h>
+#if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
+// mingw doesn't have usleep nor nanosleep...
+#include <windows.h>
+#endif
+// #include <unistd.h>
+// #include <time.h>
+// #include <sys/time.h>
+// #include <sys/types.h>
+#include <stdio.h> 
+#include <time.h> 
 #include <sys/time.h>
 #endif
 
-#include <ctime>
+
 
 struct timer_impl
@@ -58,5 +69,13 @@
 	Sleep( ms );
 #else
-	usleep( ms * 1000 );
+#if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
+	Sleep( ms );
+#else
+	struct timespec ts;
+	ts.tv_sec = 0;
+	ts.tv_nsec = ms * 1000000;
+	nanosleep(&ts, NULL);
+//	usleep( ms * 1000 );
+#endif
 #endif
 }
Index: /trunk/src/formats/assimp_loader.cc
===================================================================
--- /trunk/src/formats/assimp_loader.cc	(revision 375)
+++ /trunk/src/formats/assimp_loader.cc	(revision 376)
@@ -479,5 +479,5 @@
 }
 
-size_t nv::assimp_loader::get_nodes_data_count() const
+nv::size_t nv::assimp_loader::get_nodes_data_count() const
 {
 	if ( m_scene == nullptr ) return 0;
Index: /trunk/src/formats/md2_loader.cc
===================================================================
--- /trunk/src/formats/md2_loader.cc	(revision 375)
+++ /trunk/src/formats/md2_loader.cc	(revision 376)
@@ -167,14 +167,14 @@
 	
 	source.seek( md2->header.offset_skins, origin::SET );
-	source.read( md2->skins, sizeof(md2_skin_t), static_cast<size_t>( md2->header.num_skins ) );
+	source.read( md2->skins, sizeof( md2_skin_t ), static_cast<nv::size_t>( md2->header.num_skins ) );
 
 	source.seek( md2->header.offset_st, origin::SET );
-	source.read( md2->texcoords, sizeof(md2_texcoord_t), static_cast<size_t>( md2->header.num_st ) );
+	source.read( md2->texcoords, sizeof( md2_texcoord_t ), static_cast<nv::size_t>( md2->header.num_st ) );
 
 	source.seek( md2->header.offset_tris, origin::SET );
-	source.read( md2->triangles, sizeof(md2_triangle_t), static_cast<size_t>( md2->header.num_tris ) );
+	source.read( md2->triangles, sizeof( md2_triangle_t ), static_cast<nv::size_t>( md2->header.num_tris ) );
 
 	source.seek( md2->header.offset_glcmds, origin::SET);
-	source.read( md2->glcmds, sizeof(int), static_cast<size_t>( md2->header.num_glcmds ) );
+	source.read( md2->glcmds, sizeof( int ), static_cast<nv::size_t>( md2->header.num_glcmds ) );
 
 	md2->frames    = new md2_frame_t   [ md2->header.num_frames ];
Index: /trunk/src/formats/md3_loader.cc
===================================================================
--- /trunk/src/formats/md3_loader.cc	(revision 375)
+++ /trunk/src/formats/md3_loader.cc	(revision 376)
@@ -161,16 +161,16 @@
 
 	source.seek( pos + surface->header.ofs_shaders, origin::SET );
-	source.read( surface->shaders, sizeof( md3_shader_t ), static_cast<size_t>( surface->header.num_shaders ) );
+	source.read( surface->shaders, sizeof( md3_shader_t ), static_cast<nv::size_t>( surface->header.num_shaders ) );
 
 	source.seek( pos + surface->header.ofs_triangles, origin::SET );
-	source.read( surface->triangles, sizeof( md3_triangle_t ), static_cast<size_t>( surface->header.num_triangles ) );
+	source.read( surface->triangles, sizeof( md3_triangle_t ), static_cast<nv::size_t>( surface->header.num_triangles ) );
 
 	source.seek( pos + surface->header.ofs_st, origin::SET );
-	source.read( surface->st, sizeof( md3_texcoord_t ), static_cast<size_t>( surface->header.num_verts ) );
+	source.read( surface->st, sizeof( md3_texcoord_t ), static_cast<nv::size_t>( surface->header.num_verts ) );
 
 	source.seek( pos + surface->header.ofs_xyznormal, origin::SET );
-	source.read( surface->vertices, sizeof( md3_vertex_t ), static_cast<size_t>( surface->header.num_verts * surface->header.num_frames ) );
-
-	if ( source.tell() != static_cast<size_t>( pos + surface->header.ofs_end ) ) return false;
+	source.read( surface->vertices, sizeof( md3_vertex_t ), static_cast<nv::size_t>( surface->header.num_verts * surface->header.num_frames ) );
+
+	if ( source.tell() != static_cast<nv::size_t>( pos + surface->header.ofs_end ) ) return false;
 
 	return true;
@@ -198,13 +198,13 @@
 	md3->tags     = new md3_tag_t    [ md3->header.num_tags * md3->header.num_frames ];
 	md3->surfaces = new md3_surface_t[ md3->header.num_surfaces ];
-	std::memset( md3->surfaces, 0, static_cast< size_t >( md3->header.num_surfaces ) * sizeof(md3_surface_t) );
+	std::memset( md3->surfaces, 0, static_cast< nv::size_t >( md3->header.num_surfaces ) * sizeof( md3_surface_t ) );
 
 	source.seek( md3->header.ofs_frames, origin::SET );
-	source.read( md3->frames, sizeof( md3_frame_t ), static_cast<size_t>( md3->header.num_frames ) );
+	source.read( md3->frames, sizeof( md3_frame_t ), static_cast<nv::size_t>( md3->header.num_frames ) );
 
 	if ( md3->header.num_tags > 0 )
 	{
 		source.seek( md3->header.ofs_tags, origin::SET );
-		source.read( md3->tags, sizeof( md3_tag_t ), static_cast<size_t>( md3->header.num_tags * md3->header.num_frames ) );
+		source.read( md3->tags, sizeof( md3_tag_t ), static_cast<nv::size_t>( md3->header.num_tags * md3->header.num_frames ) );
 	}
 
@@ -321,5 +321,5 @@
 };
 
-mesh_data* nv::md3_loader::release_mesh_data( size_t index )
+mesh_data* nv::md3_loader::release_mesh_data( nv::size_t index )
 {
 	mesh_data* data = new mesh_data;
@@ -417,5 +417,5 @@
 }
 
-mesh_nodes_data* nv::md3_loader::release_mesh_nodes_data( size_t )
+mesh_nodes_data* nv::md3_loader::release_mesh_nodes_data( nv::size_t )
 {
 	md3_t* md3 = (md3_t*)m_md3;
@@ -464,5 +464,5 @@
 }
 
-size_t md3_loader::get_max_frames() const
+nv::size_t md3_loader::get_max_frames() const
 {
 	return static_cast< size_t >( ((md3_t*)m_md3)->header.num_frames );
Index: /trunk/src/formats/md5_loader.cc
===================================================================
--- /trunk/src/formats/md5_loader.cc	(revision 375)
+++ /trunk/src/formats/md5_loader.cc	(revision 376)
@@ -24,5 +24,5 @@
 static void remove_quotes( std::string& str )
 {
-	size_t n;
+	nv::size_t n;
 	while ( ( n = str.find('\"') ) != std::string::npos ) str.erase(n,1);
 }
Index: /trunk/src/formats/obj_loader.cc
===================================================================
--- /trunk/src/formats/obj_loader.cc	(revision 375)
+++ /trunk/src/formats/obj_loader.cc	(revision 376)
@@ -53,11 +53,11 @@
 	std::string next_name;
 
-	size_t size;
+	nv::size_t size;
 	bool   eof;
 
 	obj_reader();
 	bool read_stream( std::istream& stream );
-	virtual size_t add_face( uint32* vi, uint32* ti, uint32* ni, size_t count ) = 0;
-	virtual size_t raw_size() const = 0;
+	virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_t count ) = 0;
+	virtual nv::size_t raw_size() const = 0;
 	virtual void reset() = 0;
 	virtual const uint8* raw_pointer() const = 0;
@@ -172,5 +172,5 @@
 {
 	mesh_data_reader( bool normals ) : m_normals( normals ) {}
-	virtual size_t add_face( uint32* vi, uint32* ti, uint32* ni, size_t count )
+	virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_t count )
 	{
 		if ( count < 3 ) return 0; // TODO : report error?
@@ -178,10 +178,10 @@
 		// TODO : support if normals not present;
 		vec3 nullvec;
-		size_t result = 0;
+		nv::size_t result = 0;
 		// Simple triangulation - obj's shouldn't have more than quads anyway
 
 		if ( m_normals )
 		{
-			for ( size_t i = 2; i < count; ++i )
+			for ( nv::size_t i = 2; i < count; ++i )
 			{
 				result++;
@@ -193,5 +193,5 @@
 		else
 		{
-			for ( size_t i = 2; i < count; ++i )
+			for ( nv::size_t i = 2; i < count; ++i )
 			{
 				result++;
@@ -206,5 +206,5 @@
 	std::vector< VTX > m_data;
 	virtual void reset() { m_data.clear(); }
-	virtual size_t raw_size() const { return m_data.size() * sizeof( VTX ); }
+	virtual nv::size_t raw_size() const { return m_data.size() * sizeof( VTX ); }
 	virtual const uint8* raw_pointer() const { return (const uint8*)m_data.data(); }
 };
@@ -233,15 +233,15 @@
 		//		std::vector< vec3 >& tg = m_mesh->get_tangents();
 
-		size_t count  = m_data.size();
-		size_t tcount = count / 3;
+		nv::size_t count = m_data.size();
+		nv::size_t tcount = count / 3;
 
 		std::vector< vec3 > tan1( count );
 		std::vector< vec3 > tan2( count );
 
-		for (size_t a = 0; a < tcount; ++a )
-		{
-			size_t i1 = a * 3;
-			size_t i2 = a * 3 + 1;
-			size_t i3 = a * 3 + 2;
+		for ( nv::size_t a = 0; a < tcount; ++a )
+		{
+			nv::size_t i1 = a * 3;
+			nv::size_t i2 = a * 3 + 1;
+			nv::size_t i3 = a * 3 + 2;
 			obj_vertex_vtnt& vtx1 = m_data[ i1 ];
 			obj_vertex_vtnt& vtx2 = m_data[ i2 ];
@@ -278,5 +278,5 @@
 		}
 
-		for (size_t a = 0; a < count; ++a )
+		for ( nv::size_t a = 0; a < count; ++a )
 		{
 			const vec3& n = m_data[a].normal;
Index: /trunk/src/gfx/image.cc
===================================================================
--- /trunk/src/gfx/image.cc	(revision 375)
+++ /trunk/src/gfx/image.cc	(revision 376)
@@ -7,5 +7,5 @@
 using namespace nv;
 
-image::image( glm::ivec2 size, size_t depth )
+image::image( glm::ivec2 size, nv::size_t depth )
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
@@ -20,5 +20,5 @@
 
 
-image::image( glm::ivec2 size, size_t depth, const uint8 * data, bool reversed )
+image::image( glm::ivec2 size, nv::size_t depth, const uint8 * data, bool reversed )
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
Index: /trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- /trunk/src/gfx/keyframed_mesh.cc	(revision 375)
+++ /trunk/src/gfx/keyframed_mesh.cc	(revision 376)
@@ -36,5 +36,5 @@
 }
 
-size_t keyframed_mesh::get_max_frames() const
+nv::size_t keyframed_mesh::get_max_frames() const
 {
 	return m_frame_count;
Index: /trunk/src/gfx/texture_atlas.cc
===================================================================
--- /trunk/src/gfx/texture_atlas.cc	(revision 375)
+++ /trunk/src/gfx/texture_atlas.cc	(revision 376)
@@ -11,5 +11,5 @@
 using namespace nv;
 
-texture_atlas::texture_atlas( glm::ivec2 size, size_t depth, size_t border /*= 1*/ )
+texture_atlas::texture_atlas( glm::ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ )
 	: image( size, depth ), m_used( 0 ), m_border( border )
 {
@@ -82,5 +82,5 @@
 }
 
-int texture_atlas::fit( size_t index, glm::ivec2 size )
+int texture_atlas::fit( nv::size_t index, glm::ivec2 size )
 {
 	glm::ivec3 node = m_nodes[ index ];
Index: /trunk/src/gl/gl_context.cc
===================================================================
--- /trunk/src/gl/gl_context.cc	(revision 375)
+++ /trunk/src/gl/gl_context.cc	(revision 376)
@@ -329,5 +329,5 @@
 }
 
-void gl_context::update( buffer b, const void* data, size_t offset, size_t size )
+void gl_context::update( buffer b, const void* data, nv::size_t offset, nv::size_t size )
 {
 	const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) );
@@ -748,5 +748,5 @@
 }
 
-void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, size_t count )
+void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::size_t count )
 {
 	apply_render_state( rs );
Index: /trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- /trunk/src/gui/gui_gfx_renderer.cc	(revision 375)
+++ /trunk/src/gui/gui_gfx_renderer.cc	(revision 376)
@@ -107,5 +107,5 @@
 {
 public:
-	screen_render_data( context* actx, size_t initial_size )
+	screen_render_data( context* actx, nv::size_t initial_size )
 		: buffer( actx, VERTEX_BUFFER, DYNAMIC_DRAW, initial_size ), ctx( actx ), varray(), shader()
 	{
@@ -175,5 +175,5 @@
 }
 
-texture_font* gfx_renderer::get_font( size_t name ) const
+texture_font* gfx_renderer::get_font( nv::size_t name ) const
 {
 	if ( name >= m_fonts.size() ) return nullptr;
@@ -181,5 +181,5 @@
 }
 
-const image_info* gfx_renderer::get_image( size_t name ) const
+const image_info* gfx_renderer::get_image( nv::size_t name ) const
 {
 	if ( name >= m_images.size() ) return nullptr;
@@ -187,5 +187,5 @@
 }
 
-size_t gfx_renderer::load_font( const std::string& filename, size_t size )
+nv::size_t gfx_renderer::load_font( const std::string& filename, nv::size_t size )
 {
 	std::string id_name( filename );
@@ -205,5 +205,5 @@
 }
 
-size_t gfx_renderer::load_image( const std::string& filename )
+nv::size_t gfx_renderer::load_image( const std::string& filename )
 {
 	auto i = m_image_names.find( filename );
Index: /trunk/src/io/c_stream.cc
===================================================================
--- /trunk/src/io/c_stream.cc	(revision 375)
+++ /trunk/src/io/c_stream.cc	(revision 376)
@@ -3,7 +3,7 @@
 // For conditions of distribution and use, see copyright notice in nv.hh
 
+#include "nv/io/c_stream.hh"
 #include <cstdio>
 #include <sys/stat.h> 
-#include "nv/io/c_stream.hh"
 
 using namespace nv;
@@ -33,5 +33,5 @@
 }
 
-size_t c_stream::read( void* buffer, size_t size, size_t count )
+nv::size_t c_stream::read( void* buffer, nv::size_t size, nv::size_t count )
 {
 	NV_ASSERT( buffer != nullptr && size != 0 && count != 0, "Bad parameter passed to read!" );
@@ -39,5 +39,5 @@
 }
 
-size_t c_stream::write( const void* buffer, size_t size, size_t count )
+nv::size_t c_stream::write( const void* buffer, nv::size_t size, nv::size_t count )
 {
 	NV_ASSERT( buffer != nullptr && size != 0 && count != 0, "Bad parameter passed to write!" );
@@ -50,10 +50,10 @@
 }
 
-size_t c_stream::tell()
+nv::size_t c_stream::tell()
 {
-	return m_file != nullptr ? static_cast< size_t >( ::ftell( (FILE*)m_file ) ) : 0;
+	return m_file != nullptr ? static_cast< nv::size_t >( ::ftell( (FILE*)m_file ) ) : 0;
 }
 
-size_t c_stream::size()
+nv::size_t c_stream::size()
 {
 	if ( m_file == nullptr || m_file_name == nullptr )
Index: /trunk/src/lua/lua_path.cc
===================================================================
--- /trunk/src/lua/lua_path.cc	(revision 375)
+++ /trunk/src/lua/lua_path.cc	(revision 376)
@@ -32,5 +32,5 @@
 }
 
-void lua::path::push( size_t value )
+void lua::path::push( nv::size_t value )
 {
 	m_elements[ m_count ].value  = value;
Index: /trunk/src/lua/lua_state.cc
===================================================================
--- /trunk/src/lua/lua_state.cc	(revision 375)
+++ /trunk/src/lua/lua_state.cc	(revision 376)
@@ -166,5 +166,5 @@
 }
 
-size_t lua::table_guard::get_size()
+nv::size_t lua::table_guard::get_size()
 {
 	return lua_rawlen( m_state, -1 );
Index: /trunk/src/stl/assert.cc
===================================================================
--- /trunk/src/stl/assert.cc	(revision 376)
+++ /trunk/src/stl/assert.cc	(revision 376)
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#define NV_CORE_COMMON_HH
+#define NV_INTERNAL_INCLUDE
+#include "nv/stl/assert.hh"
+#undef NV_CORE_COMMON_HH
+
+#if NV_COMPILER == NV_MSVC
+
+#	if NV_DEBUG
+
+extern "C" {
+	void __cdecl _wassert( const wchar_t * _Message, const wchar_t *_File, unsigned _Line );
+}
+
+void nv_internal_assert( const wchar_t * message, const wchar_t* file, unsigned line )
+{
+	_wassert( message, file, line );
+}
+#	else  
+	void nv_internal_assert( const wchar_t *, const wchar_t*, unsigned ) {}
+#	endif  // NV_DEBUG
+#else // NV_COMPILER
+
+#	if NV_DEBUG
+#	if NV_COMPILER == NV_CLANG
+extern "C" {
+	extern void __assert(const char *, const char *, unsigned int, const char *)
+		throw() __attribute__ ((__noreturn__));
+}
+#	else
+#include <assert.h>
+#	endif
+void nv_internal_assert( const char * assertion, const char * file, unsigned int line, const char * function )
+{
+#	if NV_COMPILER == NV_CLANG
+	__assert(assertion, file, line, function );
+#	else
+	__assert_fail(assertion, file, line, function );
+#	endif
+}
+#	else
+void nv_internal_assert( const char * , const char * , unsigned int , const char * )
+{
+}
+#	endif
+
+#endif // NV_COMPILER
+
Index: /trunk/src/stl/capi.cc
===================================================================
--- /trunk/src/stl/capi.cc	(revision 376)
+++ /trunk/src/stl/capi.cc	(revision 376)
@@ -0,0 +1,7 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#include "nv/stl/capi.hh"
