Index: trunk/include/iprt/asm-math.h
===================================================================
--- trunk/include/iprt/asm-math.h	(revision 106557)
+++ trunk/include/iprt/asm-math.h	(revision 106559)
@@ -397,5 +397,5 @@
  */
 #if RT_INLINE_ASM_EXTERNAL || !defined(__GNUC__) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
-DECLASM(uint64_t) ASMMultU64ByU32DivByU32(uint64_t u64A, uint32_t u32B, uint32_t u32C);
+RT_DECL_ASM(uint64_t) ASMMultU64ByU32DivByU32(uint64_t u64A, uint32_t u32B, uint32_t u32C);
 #else
 DECLINLINE(uint64_t) ASMMultU64ByU32DivByU32(uint64_t u64A, uint32_t u32B, uint32_t u32C)
Index: trunk/include/iprt/asm-mem.h
===================================================================
--- trunk/include/iprt/asm-mem.h	(revision 106557)
+++ trunk/include/iprt/asm-mem.h	(revision 106559)
@@ -184,5 +184,5 @@
  */
 #if !defined(RDESKTOP) && (!defined(RT_OS_LINUX) || !defined(__KERNEL__))
-DECLASM(void RT_FAR *) ASMMemFirstNonZero(void const RT_FAR *pv, size_t cb) RT_NOTHROW_PROTO;
+RT_DECL_ASM(void RT_FAR *) ASMMemFirstNonZero(void const RT_FAR *pv, size_t cb) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(void RT_FAR *) ASMMemFirstNonZero(void const RT_FAR *pv, size_t cb) RT_NOTHROW_DEF
@@ -233,5 +233,5 @@
 #if    (!defined(RT_OS_LINUX) || !defined(__KERNEL__)) \
     && (!defined(RT_OS_FREEBSD) || !defined(_KERNEL))
-DECLASM(void *) ASMMemFirstMismatchingU8(void const RT_FAR *pv, size_t cb, uint8_t u8) RT_NOTHROW_PROTO;
+RT_DECL_ASM(void *) ASMMemFirstMismatchingU8(void const RT_FAR *pv, size_t cb, uint8_t u8) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(void *) ASMMemFirstMismatchingU8(void const RT_FAR *pv, size_t cb, uint8_t u8) RT_NOTHROW_DEF
Index: trunk/include/iprt/asm.h
===================================================================
--- trunk/include/iprt/asm.h	(revision 106557)
+++ trunk/include/iprt/asm.h	(revision 106559)
@@ -7804,5 +7804,5 @@
  */
 #if RT_INLINE_ASM_EXTERNAL || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
-DECLASM(int32_t) ASMBitFirstClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_PROTO;
+RT_DECL_ASM(int32_t) ASMBitFirstClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(int32_t) ASMBitFirstClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_DEF
@@ -7891,5 +7891,5 @@
  */
 #if RT_INLINE_ASM_EXTERNAL || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
-DECLASM(int) ASMBitNextClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_PROTO;
+RT_DECL_ASM(int) ASMBitNextClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(int) ASMBitNextClear(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_DEF
@@ -7961,5 +7961,5 @@
  */
 #if RT_INLINE_ASM_EXTERNAL || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
-DECLASM(int32_t) ASMBitFirstSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_PROTO;
+RT_DECL_ASM(int32_t) ASMBitFirstSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(int32_t) ASMBitFirstSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits) RT_NOTHROW_DEF
@@ -8047,5 +8047,5 @@
  */
 #if RT_INLINE_ASM_EXTERNAL || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
-DECLASM(int) ASMBitNextSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_PROTO;
+RT_DECL_ASM(int) ASMBitNextSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_PROTO;
 #else
 DECLINLINE(int) ASMBitNextSet(const volatile void RT_FAR *pvBitmap, uint32_t cBits, uint32_t iBitPrev) RT_NOTHROW_DEF
Index: trunk/include/iprt/cdefs.h
===================================================================
--- trunk/include/iprt/cdefs.h	(revision 106557)
+++ trunk/include/iprt/cdefs.h	(revision 106559)
@@ -1708,4 +1708,16 @@
 #endif
 
+/** @def DECL_EXTERN_C
+ * Prepends an 'extern "C"' in C++ code.
+ * @param   a_RetTypeExpr   The return type, calling convention, function
+ *                          attributes, and whatnot expression of the function
+ *                          declaration.
+ */
+#ifdef __cplusplus
+# define DECL_EXTERN_C(a_RetTypeExpr)   extern "C" a_RetTypeExpr
+#else
+# define DECL_EXTERN_C(a_RetTypeExpr)   a_RetTypeExpr
+#endif
+
 /** @def DECLASM
  * How to declare an internal assembly function.
@@ -1735,6 +1747,6 @@
 # define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType)   a_RetType
 #else
-# define RT_ASM_DECL_PRAGMA_WATCOM(a_RetType)       DECLASM(a_RetType)
-# define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType)   DECLASM(a_RetType)
+# define RT_ASM_DECL_PRAGMA_WATCOM(a_RetType)       RT_DECL_ASM(a_RetType)
+# define RT_ASM_DECL_PRAGMA_WATCOM_386(a_RetType)   RT_DECL_ASM(a_RetType)
 #endif
 
@@ -2111,4 +2123,22 @@
 #else
 # define RTDECL(a_RetType)      DECL_IMPORT_NOTHROW(a_RetType) RTCALL
+#endif
+
+/** @def RT_DECL_ASM(a_RetType)
+ * Runtime Library assembly export or import declaration.
+ * Functions declared using this macro exists in all contexts.
+ * @param   a_RetType   The return type of the function declaration.
+ * @remarks This is only used inside IPRT.
+ * @note    This is compatible with DECLASM, just add hidden/import/export 
+ *          attributes to the function.
+ */
+#if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
+# ifdef IN_RT_STATIC
+#  define RT_DECL_ASM(a_RetType) DECL_EXTERN_C(DECL_HIDDEN_NOTHROW(a_RetType RTCALL))
+# else
+#  define RT_DECL_ASM(a_RetType) DECL_EXTERN_C(DECL_EXPORT_NOTHROW(a_RetType RTCALL))
+# endif
+#else
+# define RT_DECL_ASM(a_RetType)  DECL_EXTERN_C(DECL_IMPORT_NOTHROW(a_RetType RTCALL))
 #endif
 
