ZEDA  1.6.18
zeda_compat.h
Go to the documentation of this file.
1 /* ZEDA - Elementary Data and Algorithms
2  * Copyright (C) 1998 Tomomichi Sugihara (Zhidao)
3  */
9 #ifndef __ZEDA_COMPAT_H__
10 #define __ZEDA_COMPAT_H__
11 
12 /* for symbol visibility in DLLs */
13 #ifdef __EXPORT
14 #undef __EXPORT
15 #endif
16 
17 #ifdef __FASTCALL
18 #undef __FASTCALL
19 #endif
20 
21 #if ( defined(__WINDOWS__) || defined(_WIN32) || defined(__WIN32__)) && !defined(__CYGWIN__)
22 # if defined(__BUILD_DLL__)
23 # define __EXPORT __declspec(dllexport)
24 # else
25 # define __EXPORT __declspec(dllimport)
26 # endif
27 # define __FASTCALL __fastcall
28 #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
29 # define __EXPORT __attribute__((visibility("default")))
30 # define __FASTCALL __attribute__((regparm(3)))
31 #else
32 # define __EXPORT
33 # define __FASTCALL
34 #endif
35 
36 /* in order to create .dll for MS-Windows, define __WINDOWS__ and
37  add the following three lines:
38  #pragma data_seg( ".share" )
39  #pragma data_seg()
40  __DEF_WINDLL
41  */
42 #ifdef __WINDOWS__
43 #include <vcl.h>
44 #include <windows.h>
45 
46 #define __DEF_WINDLL \
47 extern HINSTANCE _hInstance;\
48 int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void *reserved)\
49 {\
50  return 1;\
51 }\
52 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)\
53 {\
54  switch( reason ){\
55  case DLL_PROCESS_ATTACH:\
56  _hInstance = hinst;\
57  break;\
58  case DLL_PROCESS_DETACH:\
59  default: ;\
60  }\
61  return TRUE;\
62 }
63 #else
64 #define __DEF_WINDLL
65 #endif /* __WINDOWS__ */
66 
67 #endif /* __ZEDA_COMPAT_H__ */