00001 #ifndef __ROSEDLL__ 00002 #define __ROSEDLL__ 00003 00004 /****************************************************************** 00005 * tps (02/24/2010) 00006 * A DLL file has a layout very similar to an .exe file, with one important difference — 00007 * a DLL file contains an exports table. The exports table contains the name of every function 00008 * that the DLL exports to other executables. These functions are the entry points into the DLL; 00009 * only the functions in the exports table can be accessed by other executables. Any other functions 00010 * in the DLL are private to the DLL. 00011 * 00012 * To export a function from a DLL use the keyword : __declspec(dllexport) in the functions definition 00013 * 00014 * A program that uses public symbols defined by a DLL is said to import them. When you create header files 00015 * for applications that use your DLLs to build with, use __declspec(dllimport) on the declarations 00016 * of the public symbols. The keyword __declspec(dllimport) works with the __declspec(dllexport) keyword. 00017 * 00018 * You can use the same header file for both the DLL and the client application. 00019 * To do this, use a special preprocessor symbol that indicates whether you are building the DLL or 00020 * building the client application. To defined if you export a symbol use the library name and then _EXPORTS, 00021 * for ROSE this would be ROSE_DLL_EXPORTS. I.e. when you compile the ROSE DLL, ROSE_DLL_EXPORTS is defined 00022 * and when you compile the user code that uses the ROSE DLL, ROSE_DLL_IMPORTS is defined. 00023 * 00024 * In the configuration below ROSE_DLL_API is defined empty space as default. Special cases are: 00025 * 1) Windows: then __declspec(dllimport/export) are used 00026 * 2) Linux - GNUC >=4 and ROSE not compiling ROSE: then the visibility attribute is used to set 00027 * all symbols hidden - to simulate the effect that occurs under Windows in Linux 00028 ******************************************************************/ 00029 00030 #if defined _WIN32 || defined __CYGWIN__ 00031 #define ROSE_DLL_HELPER_DLL_IMPORT __declspec(dllimport) 00032 #define ROSE_DLL_HELPER_DLL_EXPORT __declspec(dllexport) 00033 #define ROSE_DLL_HELPER_DLL_LOCAL 00034 #else 00035 #if __GNUC__ >= 4 && !defined(USE_ROSE) 00036 #define ROSE_DLL_HELPER_DLL_IMPORT __attribute__ ((visibility("default"))) 00037 #define ROSE_DLL_HELPER_DLL_EXPORT __attribute__ ((visibility("default"))) 00038 #define ROSE_DLL_HELPER_DLL_LOCAL __attribute__ ((visibility("hidden"))) 00039 #else 00040 #define ROSE_DLL_HELPER_DLL_IMPORT 00041 #define ROSE_DLL_HELPER_DLL_EXPORT 00042 #define ROSE_DLL_HELPER_DLL_LOCAL 00043 #endif 00044 #endif 00045 00046 00047 // ROSE_DLL_EXPORTS is only defined for cmake 00048 #ifdef ROSE_DLL_EXPORTS // defined if we are building the ROSE DLL (instead of using it) 00049 #define ROSE_DLL_API ROSE_DLL_HELPER_DLL_EXPORT 00050 #else 00051 #define ROSE_DLL_API ROSE_DLL_HELPER_DLL_IMPORT 00052 #endif // ROSE_DLL_DLL_EXPORTS 00053 #define ROSE_DLL_LOCAL ROSE_DLL_HELPER_DLL_LOCAL 00054 00055 00056 // DQ (10/19/2010): Need to test if we can remove this. 00057 // We should not reference CXX_IS_ROSE_ANALYSIS except in source code. 00058 // tps : this is probably not needed anymore 00059 // undef ROSE_ROSETTA_API if rose analyses itself. 00060 // #if CXX_IS_ROSE_ANALYSIS 00061 // #undef ROSE_DLL_API 00062 // #define ROSE_DLL_API 00063 //#endif 00064 00065 00066 #endif 00067
1.4.7