summaryrefslogtreecommitdiffstats
blob: dc1c01155868c523054b12968dd7e35218d3bf8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef CPPUNIT_CONFIG_SELECTDLLLOADER_H
#define CPPUNIT_CONFIG_SELECTDLLLOADER_H

/*! \file
 * Selects DynamicLibraryManager implementation.
 *
 * Don't include this file directly. Include Portability.h instead.
 */

/*!
 * \def CPPUNIT_NO_TESTPLUGIN
 * \brief If defined, then plug-in related classes and functions will not be compiled.
 * 
 * \internal
 * CPPUNIT_HAVE_WIN32_DLL_LOADER
 * If defined, Win32 implementation of DynamicLibraryManager will be used.
 * 
 * CPPUNIT_HAVE_BEOS_DLL_LOADER
 * If defined, BeOs implementation of DynamicLibraryManager will be used.
 * 
 * CPPUNIT_HAVE_UNIX_DLL_LOADER
 * If defined, Unix implementation (dlfcn.h) of DynamicLibraryManager will be used.
 */

/*!
 * \def CPPUNIT_PLUGIN_EXPORT
 * \ingroup WritingTestPlugIn
 * \brief A macro to export a function from a dynamic library
 *
 * This macro export the C function following it from a dynamic library. 
 * Exporting the function makes it accessible to the DynamicLibraryManager.
 *
 * Example of usage:
 * \code
 * #include <cppunit/include/plugin/TestPlugIn.h>
 *
 * CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void)
 * {
 *   ...
 *   return &myPlugInInterface;
 * }
 * \endcode
 */

#if !defined(CPPUNIT_NO_TESTPLUGIN)

// Is WIN32 platform ?
#if defined(WIN32)
#define CPPUNIT_HAVE_WIN32_DLL_LOADER 1
#undef CPPUNIT_PLUGIN_EXPORT
#define CPPUNIT_PLUGIN_EXPORT extern "C" __declspec(dllexport)

// Is BeOS platform ?
#elif defined(__BEOS__)
#define CPPUNIT_HAVE_BEOS_DLL_LOADER 1

// Is Unix platform and have shl_load() (hp-ux)
#elif defined(CPPUNIT_HAVE_SHL_LOAD)
#define CPPUNIT_HAVE_UNIX_SHL_LOADER 1

// Is Unix platform and have include <dlfcn.h>
#elif defined(CPPUNIT_HAVE_LIBDL)
#define CPPUNIT_HAVE_UNIX_DLL_LOADER 1

// Otherwise, disable support for DllLoader
#else
#define CPPUNIT_NO_TESTPLUGIN 1
#endif

#if !defined(CPPUNIT_PLUGIN_EXPORT)
#define CPPUNIT_PLUGIN_EXPORT extern "C"
#endif // !defined(CPPUNIT_PLUGIN_EXPORT)

#endif // !defined(CPPUNIT_NO_TESTPLUGIN)

#endif // CPPUNIT_CONFIG_SELECTDLLLOADER_H