- Main Page
- Related Pages
- Classes
- Files

- File List

# windowsExport.h

    00001 #ifndef OPENMM_WINDOWSEXPORT_H_
    00002 #define OPENMM_WINDOWSEXPORT_H_
    00003
    00004 /*
    00005  * Shared libraries are messy in Visual Studio. We have to distinguish three
    00006  * cases:
    00007  *   (1) this header is being used to build the OpenMM shared library
    00008  *       (dllexport)
    00009  *   (2) this header is being used by a *client* of the OpenMM shared
    00010  *       library (dllimport)
    00011  *   (3) we are building the OpenMM static library, or the client is
    00012  *       being compiled with the expectation of linking with the
    00013  *       OpenMM static library (nothing special needed)
    00014  * In the CMake script for building this library, we define one of the symbols
    00015  *     OpenMM_BUILDING_{SHARED|STATIC}_LIBRARY
    00016  * Client code normally has no special symbol defined, in which case we'll
    00017  * assume it wants to use the shared library. However, if the client defines
    00018  * the symbol OPENMM_USE_STATIC_LIBRARIES we'll suppress the dllimport so
    00019  * that the client code can be linked with static libraries. Note that
    00020  * the client symbol is not library dependent, while the library symbols
    00021  * affect only the OpenMM library, meaning that other libraries can
    00022  * be clients of this one. However, we are assuming all-static or all-shared.
    00023  */
    00024
    00025 #ifdef _MSC_VER
    00026     // We don't want to hear about how sprintf is "unsafe".
    00027     #pragma warning(disable:4996)
    00028     // Keep MS VC++ quiet about lack of dll export of private members.
    00029     #pragma warning(disable:4251)
    00030     #if defined(OPENMM_BUILDING_SHARED_LIBRARY)
    00031         #define OPENMM_EXPORT __declspec(dllexport)
    00032     #elif defined(OPENMM_BUILDING_STATIC_LIBRARY) || defined(OPENMM_USE_STATIC_LIBRARIES)
    00033         #define OPENMM_EXPORT
    00034     #else
    00035         #define OPENMM_EXPORT __declspec(dllimport)   // i.e., a client of a shared library
    00036     #endif
    00037 #else
    00038     #define OPENMM_EXPORT // Linux, Mac
    00039 #endif
    00040
    00041 #endif // OPENMM_WINDOWSEXPORT_H_