Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtmail / libDtMail / Common / DynamicLib.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  *+SNOTICE
25  *
26  *
27  *      $XConsortium: DynamicLib.C /main/4 1996/04/21 19:48:04 drk $
28  *
29  *      RESTRICTED CONFIDENTIAL INFORMATION:
30  *      
31  *      The information in this document is subject to special
32  *      restrictions in a confidential disclosure agreement bertween
33  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
34  *      document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
35  *      Sun's specific written approval.  This documment and all copies
36  *      and derivative works thereof must be returned or destroyed at
37  *      Sun's request.
38  *
39  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
40  *
41  *+ENOTICE
42  */
43
44 #include "DynamicLib.hh"
45 #include "DlDynamicLib.hh"
46 #include "NotDynamic.hh"
47
48 // The purpose of this function is to map the virtual DynamicLib object
49 // into a platform specific implementation at compile time. This is
50 // a fairly ugly process that requires lots of ifdef's based on the
51 // particular implementation of shared libraries.
52 //
53 // Adding a new dynamic library implementation for a platform involves
54 // two steps:
55 //
56 //      1) Create a new implementation of the DynamicLib object (see
57 //         DlDynamicLib.C for an example).
58 //
59 //      2) Adding the appropriate ifdef construction step to this function.
60 //
61
62 DynamicLib *
63 CreatePlatformDl(const char * path)
64 {
65 #if defined(DL_DYNAMIC_LIBS)
66     DynamicLib * dl = new DlDynamicLib(path);
67 #endif
68
69 #if defined(DL_NOT_DYNAMIC)
70     DynamicLib * dl = new NotDynamic(path);
71 #endif
72
73     // WARNING WARNING WARNING WARNING WARNING WARNING WARNING
74     // *******************************************************
75     // If you get a compile error because "dl" is not defined,
76     // then you have not specified your platforms dynamic library
77     // implementation. You MUST do this for this code to work!
78     // *******************************************************
79     // WARNING WARNING WARNING WARNING WARNING WARNING WARNING
80     return(dl);
81 }
82
83 #ifndef CAN_INLINE_VIRTUALS
84 DynamicLib::~DynamicLib( void )
85 {
86 }
87 #endif /* ! CAN_INLINE_VIRTUALS */