Houdini Engine 1.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HAPI_API.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * Produced by:
7  * Side Effects Software Inc
8  * 123 Front Street West, Suite 1401
9  * Toronto, Ontario
10  * Canada M5J 2M2
11  * 416-504-9876
12  *
13  * COMMENTS:
14  */
15 
16 #ifndef __HAPI_API_h__
17 #define __HAPI_API_h__
18 
19 // Helper macros.
20 #if defined( __GNUC__ )
21  #define HAPI_IS_GCC_GE( MAJOR, MINOR ) \
22  ( __GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR) )
23 #else
24  #define HAPI_IS_GCC_GE( MAJOR, MINOR ) 0
25 #endif // defined( __GNUC__ )
26 #define HAPI_TO_STRING_( a ) # a
27 #define HAPI_TO_STRING( a ) HAPI_TO_STRING_( a )
28 
29 // Mark function as deprecated and may be removed in the future.
30 // @note This qualifier can only appear in function declarations.
31 #if defined( GCC3 )
32  #if HAPI_IS_GCC_GE( 4, 6 ) || defined( __clang__ )
33  #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
34  __attribute__( ( deprecated( \
35  "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
36  ", Houdini " HAPI_TO_STRING( houdini_ver ) ) ) )
37  #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
38  __attribute__( ( deprecated( \
39  "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
40  ", Houdini " HAPI_TO_STRING( houdini_ver ) ". Use " \
41  HAPI_TO_STRING( replacement ) " instead." ) ) )
42  #else
43  #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
44  __attribute__( ( deprecated ) )
45  #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
46  __attribute__( ( deprecated ) )
47  #endif
48 #elif defined( _MSC_VER )
49  #define HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
50  __declspec( deprecated( \
51  "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
52  ", Houdini " HAPI_TO_STRING( houdini_ver ) ) )
53  #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
54  __declspec( deprecated( \
55  "Deprecated since version HAPI " HAPI_TO_STRING( hapi_ver ) \
56  ", Houdini " HAPI_TO_STRING( houdini_ver ) ". Use " \
57  HAPI_TO_STRING( replacement ) " instead." ) )
58 #else
59  #define HAPI_DEPRECATED( hapi_ver, houdini_ver )
60  #define HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement )
61 #endif
62 
63 #if defined( WIN32 ) && !defined( MAKING_STATIC )
64  #define HAPI_VISIBILITY_EXPORT __declspec( dllexport )
65  #define HAPI_VISIBILITY_IMPORT __declspec( dllimport )
66  #define HAPI_VISIBILITY_EXPORT_TINST HAPI_VISIBILITY_EXPORT
67  #define HAPI_VISIBILITY_IMPORT_TINST HAPI_VISIBILITY_IMPORT
68 #elif defined(__GNUC__) && HAPI_IS_GCC_GE( 4, 2 ) && !defined( MAKING_STATIC )
69  #define HAPI_VISIBILITY_EXPORT __attribute__( ( visibility( "default" ) ) )
70  #define HAPI_VISIBILITY_IMPORT __attribute__( ( visibility( "default" ) ) )
71  #define HAPI_VISIBILITY_EXPORT_TINST
72  #define HAPI_VISIBILITY_IMPORT_TINST
73 #else
74  #define HAPI_VISIBILITY_EXPORT
75  #define HAPI_VISIBILITY_IMPORT
76  #define HAPI_VISIBILITY_EXPORT_TINST
77  #define HAPI_VISIBILITY_IMPORT_TINST
78 #endif
79 
80 #ifdef EXPORT_HAPI
81  #define HAPI_API HAPI_VISIBILITY_EXPORT
82 #else
83  #define HAPI_API HAPI_VISIBILITY_IMPORT
84 #endif // EXPORT_HAPI
85 
86 #if defined( WIN32 )
87  #define HAPI_CALL __cdecl
88 #else
89  #define HAPI_CALL
90 #endif // defined( WIN32 )
91 
92 #ifdef __cplusplus
93  #define HAPI_EXTERN_C extern "C"
94 #else
95  #define HAPI_EXTERN_C
96 #endif // __cplusplus
97 
98 #define HAPI_RETURN HAPI_Result HAPI_CALL
99 
100 #define HAPI_DECL_RETURN( r ) HAPI_EXTERN_C HAPI_API r HAPI_CALL
101 #define HAPI_DECL_DEPRECATED( hapi_ver, houdini_ver ) \
102  HAPI_EXTERN_C \
103  HAPI_DEPRECATED( hapi_ver, houdini_ver ) \
104  HAPI_API \
105  HAPI_RETURN
106 #define HAPI_DECL_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
107  HAPI_EXTERN_C \
108  HAPI_DEPRECATED_REPLACE( hapi_ver, houdini_ver, replacement ) \
109  HAPI_API \
110  HAPI_RETURN
111 
112 #define HAPI_DECL HAPI_EXTERN_C HAPI_API HAPI_RETURN
113 #define HAPI_DEF HAPI_EXTERN_C HAPI_RETURN
114 
115 #endif // __HAPI_API_h__