fbsdk/fblibrary.h Source File
 
 
 
fbsdk/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                                 int/*BOOL*/ __stdcall/*WINAPI*/ DllMain(void*/*HINSTANCE*/ hinstDLL,unsigned long/*DWORD*/ fdwReason, void*/*LPVOID*/ lpvReserved )\
00069                                 { \
00070                                         switch (fdwReason) \
00071                                         { \
00072                                         case 1/*DLL_PROCESS_ATTACH*/: EntryPoint##DLLNAME(kFBDllLoad); break; \
00073                                         case 0/*DLL_PROCESS_DETACH*/: EntryPoint##DLLNAME(kFBDllUnLoad); break; \
00074                                         } \
00075                                         return 1/*TRUE*/; \
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 /* _KAYDARA_LIB_H_ */