Go to the documentation of this file.
10 #define __HAPI_API_h__
13 #if defined( __GNUC__ )
14 #define HAPI_IS_GCC_GE( MAJOR, MINOR ) \
15 ( __GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR) )
17 #define HAPI_IS_GCC_GE( MAJOR, MINOR ) 0
18 #endif // defined( __GNUC__ )
19 #define HAPI_TO_STRING_( a ) # a
20 #define HAPI_TO_STRING( a ) HAPI_TO_STRING_( a )
24 #ifdef HAPI_SUPPRESS_DEPRECATIONS
25 #define HAPI_DEPRECATED( hapi_ver, houdini_ver )
26 #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement )
28 #if HAPI_IS_GCC_GE( 4, 6 ) || defined( __clang__ )
29 #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
30 __attribute__( ( deprecated( \
31 "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
32 ", Houdini " HAPI_TO_STRING( houdini_ver ) ) ) )
33 #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
34 __attribute__( ( deprecated( \
35 "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
36 ", Houdini " HAPI_TO_STRING( houdini_ver ) ". Use " \
37 HAPI_TO_STRING( replacement ) " instead." ) ) )
39 #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
40 __attribute__( ( deprecated ) )
41 #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
42 __attribute__( ( deprecated ) )
44 #elif defined( _MSC_VER )
45 #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
46 __declspec( deprecated( \
47 "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
48 ", Houdini " HAPI_TO_STRING( houdini_ver ) ) )
49 #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
50 __declspec( deprecated( \
51 "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
52 ", Houdini " HAPI_TO_STRING( houdini_ver ) ". Use " \
53 HAPI_TO_STRING( replacement ) " instead." ) )
55 #define HAPI_DEPRECATED( hapi_ver, houdini_ver )
56 #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement )
59 #if defined( WIN32 ) && !defined( MAKING_STATIC )
60 #define HAPI_VISIBILITY_EXPORT __declspec( dllexport )
61 #define HAPI_VISIBILITY_IMPORT __declspec( dllimport )
62 #define HAPI_VISIBILITY_EXPORT_TINST HAPI_VISIBILITY_EXPORT
63 #define HAPI_VISIBILITY_IMPORT_TINST HAPI_VISIBILITY_IMPORT
64 #elif defined(__GNUC__) && HAPI_IS_GCC_GE( 4, 2 ) && !defined( MAKING_STATIC )
65 #define HAPI_VISIBILITY_EXPORT __attribute__( ( visibility( "default" ) ) )
66 #define HAPI_VISIBILITY_IMPORT __attribute__( ( visibility( "default" ) ) )
67 #define HAPI_VISIBILITY_EXPORT_TINST
68 #define HAPI_VISIBILITY_IMPORT_TINST
70 #define HAPI_VISIBILITY_EXPORT
71 #define HAPI_VISIBILITY_IMPORT
72 #define HAPI_VISIBILITY_EXPORT_TINST
73 #define HAPI_VISIBILITY_IMPORT_TINST
77 #define HAPI_API HAPI_VISIBILITY_EXPORT
79 #define HAPI_API HAPI_VISIBILITY_IMPORT
80 #endif // HAPI_EXPORTS
83 #define HAPI_CALL __cdecl
86 #endif // defined( WIN32 )
89 #define HAPI_EXTERN_C extern "C"
94 #define HAPI_RETURN HAPI_Result HAPI_CALL
96 #define HAPI_DECL_RETURN( r ) HAPI_EXTERN_C HAPI_API r HAPI_CALL
97 #define HAPI_DECL_DEPRECATED( hapi_ver, houdini_ver ) \
99 HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
102 #define HAPI_DECL_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
104 HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
108 #define HAPI_DECL HAPI_EXTERN_C HAPI_API HAPI_RETURN
109 #define HAPI_DEF HAPI_EXTERN_C HAPI_RETURN
113 #define HAPI_STATIC_ASSERT( cond, msg ) \
115 struct HAPI_StaticAssert_##msg {}; \
117 struct HAPI_StaticAssert_##msg< true > \
119 typedef int static_assert_##msg; \
121 typedef HAPI_StaticAssert_##msg< ( cond ) >::static_assert_##msg _sa
123 #define HAPI_STATIC_ASSERT( cond, msg ) HAPI_STATIC_ASSERT_I( cond, msg )
124 #define HAPI_STATIC_ASSERT_I( cond, msg ) \
125 typedef char static_assert_##msg[ 2 * ( cond ) - 1 ]
126 #endif // __cplusplus
128 #endif // __HAPI_API_h__