OCILIB (C and C++ Driver for Oracle)  4.7.6
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
platform.h
1 /*
2  * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
3  *
4  * Website: http://www.ocilib.net
5  *
6  * Copyright (c) 2007-2023 Vincent ROGIER <vince.rogier@ocilib.net>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 /* IMPORTANT NOTICE
22  *
23  * This file contains explanations about Oracle and OCI technologies.
24  * OCILIB is a wrapper around OCI and thus exposes OCI features.
25  * The OCILIB documentation intends to explain Oracle / OCI concepts
26  * and is naturally based on the official Oracle OCI documentation.
27  *
28  * Some parts of OCILIB documentation may include some information
29  * taken and adapted from the following Oracle documentations :
30  * - Oracle Call Interface Programmer's Guide
31  * - Oracle Streams - Advanced Queuing User's Guide
32  */
33 
34 #ifndef OCILIB_OCILIBC_PLATFORM_H_INCLUDED
35 #define OCILIB_OCILIBC_PLATFORM_H_INCLUDED
36 
43 /* --------------------------------------------------------------------------------------------- *
44  * C headers
45  * --------------------------------------------------------------------------------------------- */
46 
47 #include <stdlib.h>
48 #include <stdio.h>
49 #include <stdarg.h>
50 #include <ctype.h>
51 #include <wctype.h>
52 #include <string.h>
53 #include <time.h>
54 #include <limits.h>
55 
56 /* --------------------------------------------------------------------------------------------- *
57  * MS Windows platform detection
58  * --------------------------------------------------------------------------------------------- */
59 
60 #ifndef _WINDOWS
61  #if defined(_WIN32)|| defined(WIN32) || defined(_WIN64) || defined(WIN64) || defined(_WIN32_WINNT)
62  #define _WINDOWS
63  #endif
64 #endif
65 
66 #ifdef _WINDOWS
67  #ifdef boolean
68  #undef boolean
69  #endif
70  #include <Windows.h>
71  #ifdef boolean
72  #undef boolean
73  #endif
74 #endif
75 
76 /* --------------------------------------------------------------------------------------------- *
77  * OCILIB version information
78  * --------------------------------------------------------------------------------------------- */
79 
80 #define OCILIB_MAJOR_VERSION 4
81 #define OCILIB_MINOR_VERSION 7
82 #define OCILIB_REVISION_VERSION 6
83 
84 /* Import mode */
85 
86 #define OCI_IMPORT_MODE_LINKAGE 1
87 #define OCI_IMPORT_MODE_RUNTIME 2
88 
89 #ifdef OCI_IMPORT_RUNTIME
90  #undef OCI_IMPORT_LINKAGE
91 #endif
92 
93 #ifdef OCI_IMPORT_LINKAGE
94  #undef OCI_IMPORT_RUNTIME
95 #endif
96 
97 #if !defined(OCI_IMPORT_RUNTIME) && !defined(OCI_IMPORT_LINKAGE)
98  #define OCI_IMPORT_LINKAGE
99 #endif
100 
101 #ifdef OCI_IMPORT_RUNTIME
102  #define OCI_IMPORT_MODE OCI_IMPORT_MODE_RUNTIME
103 #else
104  #define OCI_IMPORT_MODE OCI_IMPORT_MODE_LINKAGE
105 #endif
106 
107 
108 /* Calling convention */
109 
110 #ifndef OCI_API
111  #ifdef _MSC_VER
112  #define OCI_API __stdcall
113  #else
114  #define OCI_API
115  #endif
116 #endif
117 
118 /* Control of symbol visibility for shared libraries */
119 
120 #if defined _WINDOWS
121  #define OCI_SYM_PUBLIC_IMPORT __declspec(dllimport)
122  #define OCI_SYM_PUBLIC_EXPORT __declspec(dllexport)
123  #define OCI_SYM_LOCAL
124 #else
125  #if __GNUC__ >= 4
126  #define OCI_SYM_PUBLIC_IMPORT __attribute__ ((visibility ("default")))
127  #define OCI_SYM_PUBLIC_EXPORT __attribute__ ((visibility ("default")))
128  #define OCI_SYM_LOCAL __attribute__ ((visibility ("hidden")))
129  #else
130  #define OCI_SYM_PUBLIC_IMPORT
131  #define OCI_SYM_PUBLIC_EXPORT
132  #define OCI_SYM_LOCAL
133  #endif
134 #endif
135 
136 #ifdef OCI_LIB_LOCAL_COMPILE
137  #define OCI_SYM_PUBLIC
138 #else
139  #ifdef OCI_EXPORT
140  #define OCI_SYM_PUBLIC OCI_SYM_PUBLIC_EXPORT
141  #else
142  #define OCI_SYM_PUBLIC OCI_SYM_PUBLIC_IMPORT
143  #endif
144 #endif
145 
146 /* Charset modes */
147 
148 #ifdef OCI_CHARSET_UNICODE
149  #define OCI_CHARSET_WIDE
150 #endif
151 
152 #ifdef OCI_CHARSET_WIDE
153  #undef OCI_CHARSET_ANSI
154 #endif
155 
156 #ifdef OCI_CHARSET_ANSI
157  #undef OCI_CHARSET_WIDE
158 #endif
159 
160 #if !defined(OCI_CHARSET_ANSI) && !defined(OCI_CHARSET_WIDE)
161  #define OCI_CHARSET_ANSI
162 #endif
163 
232 #if defined(__cplusplus) && defined(_MSC_VER) && (_MSC_VER < 1300)
233 extern "C++" {
234 #endif
235 
236 #include <wchar.h>
237 
238 #if defined(__cplusplus) && defined(_MSC_VER) && (_MSC_VER < 1300)
239 }
240 #endif
241 
242 /* Charset macros */
243 
244 #define OCI_CHAR_ANSI 1
245 #define OCI_CHAR_WIDE 2
246 
247 #ifdef OCI_CHARSET_ANSI
248  typedef char otext;
249  #define OTEXT(x) x
250  #define OCI_CHAR_TEXT OCI_CHAR_ANSI
251 #else
252  typedef wchar_t otext;
253  #define OTEXT(x) L ## x
254  #define OCI_CHAR_TEXT OCI_CHAR_WIDE
255 #endif
256 
275 /* check for long long support */
276 
277 #if defined(_LONGLONG) || defined(LONG_LONG_MAX) || defined(LLONG_MAX) || defined(__LONG_LONG_MAX__)
278 
279 /* C99 long long supported */
280 
281 typedef long long big_int;
282 typedef unsigned long long big_uint;
283 
284 #define OCI_BIG_UINT_ENABLED
285 
286 #elif defined(_WINDOWS)
287 
288 /* Microsoft extension supported */
289 
290 typedef __int64 big_int;
291 typedef unsigned __int64 big_uint;
292 
293  #define OCI_BIG_UINT_ENABLED
294 
295 #else
296 
297 typedef int big_int;
298 typedef unsigned int big_uint;
299 
300 #endif
301 
302 /* boolean values */
303 
304 #ifndef TRUE
305  #define TRUE 1
306  #define FALSE 0
307 #endif
308 
309 #ifndef boolean
310 #define boolean int
311 #endif
312 
321 #endif /* OCILIB_OCILIBC_PLATFORM_H_INCLUDED */
long long big_int
big_int is a C scalar integer (32 or 64 bits) depending on compiler support for 64bits integers....
Definition: platform.h:281