fbsdk/fblibrary.h Source File

fblibrary.h
Go to the documentation of this file.
1 #ifndef _KAYDARA_LIB_H_
2 #define _KAYDARA_LIB_H_
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
39 #include <kaydara.h>
40 #include <kaydaradef.h>
41 
43 
44 #define FB_MANUAL_DLL_INIT(Name) \
45  extern void EntryPoint##Name(kFBDllOperation STARTUP); \
46  EntryPoint##Name(kFBDllLoad); \
47 
48 #if defined(K_NODLL)
49  #ifndef FB_KERNEL
50  #define FB_DLL_INIT(DLLNAME,STARTUP)\
51  int DummyEntryPoint##DLLNAME();\
52  static int StatEntryPoint##DLLNAME = DummyEntryPoint##DLLNAME();\
53  void EntryPoint##DLLNAME(kFBDllOperation STARTUP);\
54  int DummyEntryPoint##DLLNAME()\
55  { \
56  EntryPoint##DLLNAME(kFBDllLoad);\
57  return 0; \
58  } \
59  void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
60  #else
61  #define FB_DLL_INIT(DLLNAME,STARTUP)\
62  void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
63  #endif
64 #else
65  #if defined(KARCH_ENV_WIN32)
66  #define FB_DLL_INIT(DLLNAME,STARTUP)\
67  __declspec(dllexport) void EntryPoint##DLLNAME(kFBDllOperation STARTUP);\
68  int/*BOOL*/ __stdcall/*WINAPI*/ DllMain(void*/*HINSTANCE*/ hinstDLL,unsigned long/*DWORD*/ fdwReason, void*/*LPVOID*/ lpvReserved )\
69  { \
70  switch (fdwReason) \
71  { \
72  case 1/*DLL_PROCESS_ATTACH*/: EntryPoint##DLLNAME(kFBDllLoad); break; \
73  case 0/*DLL_PROCESS_DETACH*/: EntryPoint##DLLNAME(kFBDllUnLoad); break; \
74  } \
75  return 1/*TRUE*/; \
76  }\
77  void EntryPoint##DLLNAME(kFBDllOperation STARTUP)
78  #elif defined (KARCH_DEV_GNUC)
79  #define FB_DLL_INIT( DllName,Startup ) \
80  void EntryPoint##DllName(kFBDllOperation Startup); \
81  void __attribute__((constructor)) KdsoInit##DllName ( void ) \
82  { \
83  EntryPoint##DllName(kFBDllLoad);\
84  }\
85  void __attribute__ ((destructor)) KdsoDone##DllName ( void ) \
86  { \
87  EntryPoint##DllName(kFBDllUnLoad);\
88  }\
89  void EntryPoint##DllName(kFBDllOperation Startup)
90  #else
91  #define FB_DLL_INIT( DllName,Startup ) \
92  void EntryPoint##DllName(kFBDllOperation Startup); \
93  extern "C" void KdsoInit##DllName( void ) \
94  { \
95  EntryPoint##DllName(kFBDllLoad);\
96  }\
97  extern "C" void KdsoDone##DllName( void ) \
98  { \
99  EntryPoint##DllName(kFBDllUnLoad);\
100  }\
101  class Init##DllName { public: Init##DllName () {KdsoInit##DllName (); } ~Init##DllName () {KdsoDone##DllName (); } }; \
102  static Init##DllName Flakel##DllName; \
103  void EntryPoint##DllName(kFBDllOperation Startup)
104 
105  #endif
106 #endif
107 
108 #define FB_EXT_INIT(libname)
109 
110 #endif /* _KAYDARA_LIB_H_ */
kFBDllOperation
Definition: fblibrary.h:42