1 // -*- Mode: C++; -*-
2 //                            Package   : omniORB
3 // dynamicLib.h               Created on: 15/9/99
4 //                            Author    : David Riddoch (djr)
5 //
6 //    Copyright (C) 1996-1999 AT&T Laboratories Cambridge
7 //
8 //    This file is part of the omniORB library
9 //
10 //    The omniORB library is free software; you can redistribute it and/or
11 //    modify it under the terms of the GNU Lesser General Public
12 //    License as published by the Free Software Foundation; either
13 //    version 2.1 of the License, or (at your option) any later version.
14 //
15 //    This library is distributed in the hope that it will be useful,
16 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
17 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 //    Lesser General Public License for more details.
19 //
20 //    You should have received a copy of the GNU Lesser General Public
21 //    License along with this library. If not, see http://www.gnu.org/licenses/
22 //
23 //
24 // Description:
25 //    Hook to allow orbcore to access dynamic library when linked.
26 //
27 
28 #ifndef __DYNAMICLIB_H__
29 #define __DYNAMICLIB_H__
30 
31 
32 #if defined(_OMNIORB_LIBRARY)
33 # define _core_attr
34 #elif defined(_OMNIORB_DYNAMIC_LIBRARY)
35 # define _core_attr _OMNIORB_NTDLL_IMPORT
36 #else
37 # error "Neither _OMNIORB_LIBRARY nor _OMNIORB_DYNAMIC_LIBRARY defined"
38 #endif
39 
40 class omniCallDescriptor;
41 
OMNI_NAMESPACE_BEGIN(omni)42 OMNI_NAMESPACE_BEGIN(omni)
43 
44 
45 class omniDynamicLib {
46 public:
47 
48   // This points to the implementation of dynamic library functions
49   // that the orbcore library should use.  If the dynamic library
50   // is linked then the real functions are called.  Otherwise
51   // stub versions are called which do nothing, or deal with the
52   // error appropriately.
53   static _core_attr omniDynamicLib* ops;
54 
55   // This points to the dynamic library's version of the functions
56   // if the dynamic is linked, or is zero otherwise.
57   static _core_attr omniDynamicLib* hook;
58 
59   ////////////////////////////////////////////////
60   // Operations exported by the dynamic library //
61   ////////////////////////////////////////////////
62 
63   // Initialisation
64   void (*init)();
65   void (*deinit)();
66 
67   // Local call call-back function for CORBA::Repository::lookup_id().
68   // This is needed to support the server side of _get_interface(),
69   // in the case that the interface repository is co-located!
70   void (*lookup_id_lcfn)(omniCallDescriptor*, omniServant*);
71 };
72 
73 
74 #undef _core_attr
75 
76 OMNI_NAMESPACE_END(omni)
77 
78 #endif  // __DYNAMICLIB_H__
79