ROSE 0.11.145.147
rosedll.h
1#ifndef ROSE_rosedll_H
2#define ROSE_rosedll_H
3
4/******************************************************************
5 * tps (02/24/2010)
6 * A DLL file has a layout very similar to an .exe file, with one important difference —
7 * a DLL file contains an exports table. The exports table contains the name of every function
8 * that the DLL exports to other executables. These functions are the entry points into the DLL;
9 * only the functions in the exports table can be accessed by other executables. Any other functions
10 * in the DLL are private to the DLL.
11 *
12 * To export a function from a DLL use the keyword : __declspec(dllexport) in the functions definition
13 *
14 * A program that uses public symbols defined by a DLL is said to import them. When you create header files
15 * for applications that use your DLLs to build with, use __declspec(dllimport) on the declarations
16 * of the public symbols. The keyword __declspec(dllimport) works with the __declspec(dllexport) keyword.
17 *
18 * You can use the same header file for both the DLL and the client application.
19 * To do this, use a special preprocessor symbol that indicates whether you are building the DLL or
20 * building the client application. To defined if you export a symbol use the library name and then _EXPORTS,
21 * for ROSE this would be ROSE_DLL_EXPORTS. I.e. when you compile the ROSE DLL, ROSE_DLL_EXPORTS is defined
22 * and when you compile the user code that uses the ROSE DLL, ROSE_DLL_IMPORTS is defined.
23 *
24 * In the configuration below ROSE_DLL_API is defined empty space as default. Special cases are:
25 * 1) Windows: then __declspec(dllimport/export) are used
26 * 2) Linux - GNUC >=4 and ROSE not compiling ROSE: then the visibility attribute is used to set
27 * all symbols hidden - to simulate the effect that occurs under Windows in Linux
28 ******************************************************************/
29
30#if defined _WIN32 || defined __CYGWIN__
31 #define ROSE_DLL_HELPER_DLL_IMPORT __declspec(dllimport)
32 #define ROSE_DLL_HELPER_DLL_EXPORT __declspec(dllexport)
33 #define ROSE_DLL_HELPER_DLL_LOCAL
34#elif __GNUC__ >= 4 && !defined(USE_ROSE)
35 #define ROSE_DLL_HELPER_DLL_IMPORT __attribute__ ((visibility("default")))
36 #define ROSE_DLL_HELPER_DLL_EXPORT __attribute__ ((visibility("default")))
37 #define ROSE_DLL_HELPER_DLL_LOCAL __attribute__ ((visibility("hidden")))
38#else
39 #define ROSE_DLL_HELPER_DLL_IMPORT
40 #define ROSE_DLL_HELPER_DLL_EXPORT
41 #define ROSE_DLL_HELPER_DLL_LOCAL
42#endif
43
44// ROSE_DLL_EXPORTS is only defined for cmake
45#ifdef ROSE_DLL_EXPORTS // defined if we are building the ROSE DLL (instead of using it)
46 #define ROSE_DLL_API ROSE_DLL_HELPER_DLL_EXPORT
47#else
48 #define ROSE_DLL_API ROSE_DLL_HELPER_DLL_IMPORT
49#endif
50
51#ifdef ROSE_UTIL_EXPORTS
52 #define ROSE_UTIL_API ROSE_DLL_HELPER_DLL_EXPORT
53#else
54 #define ROSE_UTIL_API ROSE_DLL_HELPER_DLL_IMPORT
55#endif
56
57#endif
58