fblibrary.h

Go to the documentation of this file.
00001 #ifndef _KAYDARA_LIB_H_
00002 #define _KAYDARA_LIB_H_
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
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                 BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpvReserved )\
00069                 { \
00070                     switch (fdwReason) \
00071                     { \
00072                     case DLL_PROCESS_ATTACH: EntryPoint##DLLNAME(kFBDllLoad); break; \
00073                     case DLL_PROCESS_DETACH: EntryPoint##DLLNAME(kFBDllUnLoad); break; \
00074                     } \
00075                     return TRUE; \
00076                 }\
00077             void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
00078     #elif defined (KARCH_ENV_LINUX)
00079         #define FB_DLL_INIT( DllName,Startup ) \
00080         void EntryPoint##DllName(kFBDllOperation Startup); \
00081         extern "C" void KdsoInit##DllName ( void ) \
00082             { \
00083             EntryPoint##DllName(kFBDllLoad);\
00084             }\
00085         class Init##DllName { public: Init##DllName ()  {KdsoInit##DllName (); } }; \
00086         static Init##DllName Flakel##DllName; \
00087             extern "C" void KdsoDone( void ) \
00088             { \
00089             EntryPoint##DllName(kFBDllUnLoad);\
00090             }\
00091         void EntryPoint##DllName(kFBDllOperation Startup)
00092     #elif defined(KARCH_ENV_MACOSX)
00093         #define FB_DLL_INIT( DllName,Startup ) \
00094         void EntryPoint##DllName(kFBDllOperation Startup); \
00095         extern "C" void KdsoInit##DllName( void ) \
00096         { \
00097             EntryPoint##DllName(kFBDllLoad);\
00098         }\
00099         extern "C" void KdsoDone##DllName( void ) \
00100         { \
00101             EntryPoint##DllName(kFBDllUnLoad);\
00102         }\
00103         void EntryPoint##DllName(kFBDllOperation Startup)
00104 
00105     #endif
00106 #endif
00107 
00108 #define KO_MODULE_CALL( Name ) \
00109     extern void KModule##Name( ); \
00110     KModule##Name( );
00111 
00112 #ifdef KARCH_ENV_MACOSX
00113 #define FB_EXT_INIT(libname)\
00114 {\
00115     /*extern "C"*/ void KdsoInit##libname( void ); \
00116     KdsoInit##libname();\
00117 }
00118 #else
00119 #define FB_EXT_INIT(libname)
00120 #endif
00121 
00122 #endif /* _KAYDARA_LIB_H_ */