1 /*---------------------------------------------------------------------------* 2 * PortExport.h * 3 * * 4 * Copyright 2007, 2008 Nuance Communciations, Inc. * 5 * * 6 * Licensed under the Apache License, Version 2.0 (the 'License'); * 7 * you may not use this file except in compliance with the License. * 8 * * 9 * You may obtain a copy of the License at * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, software * 13 * distributed under the License is distributed on an 'AS IS' BASIS, * 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 15 * See the License for the specific language governing permissions and * 16 * limitations under the License. * 17 * * 18 *---------------------------------------------------------------------------*/ 19 20 #ifndef __PORT_EXPORT_H 21 #define __PORT_EXPORT_H 22 23 24 25 /* (1) Platform specific macro which handles symbol exports & imports.*/ 26 27 /* These macros are used if defining DLL import/export in the source file 28 * rather than through a .def file. */ 29 30 /** 31 * @addtogroup ESR_PortableModule ESR_Portable API functions 32 * 33 * @{ 34 */ 35 36 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 38 #ifdef _WIN32 39 40 #ifndef HAS_INLINE 41 #define HAS_INLINE 42 #endif 43 44 #ifdef __cplusplus 45 46 #define PORT_EXPORT_DECL extern "C" __declspec(dllexport) 47 #define PORT_IMPORT_DECL extern "C" __declspec(dllimport) 48 49 #else /* not __cplusplus */ 50 51 #define PORT_EXPORT_DECL __declspec(dllexport) 52 #define PORT_IMPORT_DECL __declspec(dllimport) 53 #endif /* __cplusplus */ 54 55 #else /* not _WIN32 */ 56 57 #ifdef __cplusplus 58 #define PORT_EXPORT_DECL extern "C" 59 #define PORT_IMPORT_DECL extern "C" 60 #else 61 #define PORT_EXPORT_DECL extern 62 #define PORT_IMPORT_DECL extern 63 #endif /* __cplusplus */ 64 65 #endif /* _WIN32 */ 66 67 #if !defined(PORT_EXPORT_DECL) || !defined(PORT_IMPORT_DECL) 68 #error Symbol import/export pair not defined. 69 #endif 70 71 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 72 73 /* If using a .def file on win32, use these macros. */ 74 #ifdef __cplusplus 75 76 /** 77 * Exports C-style symbols; avoids name-mangling. 78 */ 79 #define EXTERN extern "C" 80 #else 81 82 /** 83 * Exports C-style symbols; avoids name-mangling. 84 */ 85 #define EXTERN extern 86 #endif 87 88 #ifdef __cplusplus 89 90 /** 91 * Portable 'inline' keyword 92 */ 93 #define PINLINE inline 94 #elif defined(_WIN32) 95 96 /** 97 * Portable 'inline' keyword 98 */ 99 #define PINLINE _inline 100 #elif defined(__GNUC__) 101 102 /** 103 * Portable 'inline' keyword 104 */ 105 #ifdef __vxworks 106 #define PINLINE __inline__ 107 #else 108 #define PINLINE __inline__ 109 #endif 110 111 #elif !defined(PINLINE) 112 113 /** 114 * Portable 'inline' keyword 115 */ 116 #define PINLINE 117 #endif 118 119 /** 120 * inlining causes problems for the Xcode 4.3 and 4.4 command line tools, 121 * so this is needed to ensure the methods aren't inlined on those compilers 122 */ 123 124 #if defined(__APPLE_CC__) 125 #if __APPLE_CC__ >= 5621 126 #undef PINLINE 127 #define PINLINE 128 #endif 129 #endif 130 131 /** 132 * @} 133 */ 134 135 #endif 136