Go to the
documentation of this file.
00001 #ifndef _KAYDARA_LIB_H_
00002 #define _KAYDARA_LIB_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <kaydara.h>
00040 #include <kaydaradef.h>
00041
00042 enum kFBDllOperation { kFBDllLoad, kFBDllUnLoad };
00043
00044 #define FB_MANUAL_DLL_INIT(Name) \
00045 extern void EntryPoint##Name(kFBDllOperation STARTUP); \
00046 EntryPoint##Name(kFBDllLoad); \
00047
00048 #if defined(K_NODLL)
00049 #ifndef FB_KERNEL
00050 #define FB_DLL_INIT(DLLNAME,STARTUP)\
00051 int DummyEntryPoint##DLLNAME();\
00052 static int StatEntryPoint##DLLNAME = DummyEntryPoint##DLLNAME();\
00053 void EntryPoint##DLLNAME(kFBDllOperation STARTUP);\
00054 int DummyEntryPoint##DLLNAME()\
00055 { \
00056 EntryPoint##DLLNAME(kFBDllLoad);\
00057 return 0; \
00058 } \
00059 void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
00060 #else
00061 #define FB_DLL_INIT(DLLNAME,STARTUP)\
00062 void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
00063 #endif
00064 #else
00065 #if defined(KARCH_ENV_WIN32)
00066 #define FB_DLL_INIT(DLLNAME,STARTUP)\
00067 __declspec(dllexport) void EntryPoint##DLLNAME(kFBDllOperation STARTUP);\
00068 int __stdcall DllMain(void* hinstDLL,unsigned long fdwReason, void* lpvReserved )\
00069 { \
00070 switch (fdwReason) \
00071 { \
00072 case 1: EntryPoint##DLLNAME(kFBDllLoad); break; \
00073 case 0: EntryPoint##DLLNAME(kFBDllUnLoad); break; \
00074 } \
00075 return 1; \
00076 }\
00077 void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
00078 #elif defined (KARCH_DEV_GNUC)
00079 #define FB_DLL_INIT( DllName,Startup ) \
00080 void EntryPoint##DllName(kFBDllOperation Startup); \
00081 void __attribute__((constructor)) KdsoInit##DllName ( void ) \
00082 { \
00083 EntryPoint##DllName(kFBDllLoad);\
00084 }\
00085 void __attribute__ ((destructor)) KdsoDone##DllName ( void ) \
00086 { \
00087 EntryPoint##DllName(kFBDllUnLoad);\
00088 }\
00089 void EntryPoint##DllName(kFBDllOperation Startup)
00090 #else
00091 #define FB_DLL_INIT( DllName,Startup ) \
00092 void EntryPoint##DllName(kFBDllOperation Startup); \
00093 extern "C" void KdsoInit##DllName( void ) \
00094 { \
00095 EntryPoint##DllName(kFBDllLoad);\
00096 }\
00097 extern "C" void KdsoDone##DllName( void ) \
00098 { \
00099 EntryPoint##DllName(kFBDllUnLoad);\
00100 }\
00101 class Init##DllName { public: Init##DllName () {KdsoInit##DllName (); } ~Init##DllName () {KdsoDone##DllName (); } }; \
00102 static Init##DllName Flakel##DllName; \
00103 void EntryPoint##DllName(kFBDllOperation Startup)
00104
00105 #endif
00106 #endif
00107
00108 #define FB_EXT_INIT(libname)
00109
00110 #endif