1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-05 20:55:47 +03:00

build: respect autotools DLL_EXPORT in libssh2.h

The `DLL_EXPORT` macro is automatically set by autotools when building
the libssh2 DLL. Certain toolchains might require this to correctly
export symbols, so make sure to respect it in `libssh2.h` to enable
`declspec(dllexport)`.

With this patch we have a manual macro for that (`LIBSSH2_EXPORT`),
this autotools one, the CMake one, and `_WINDLL` (added in
c355d31ff9), possibly defined by Visual
Studio.

Closes #917
This commit is contained in:
Viktor Szakats
2023-04-02 03:24:39 +00:00
parent 185292a06b
commit fb1195cf88

View File

@@ -100,7 +100,7 @@ extern "C" {
/* Allow alternate API prefix from CFLAGS or calling app */
#ifndef LIBSSH2_API
# ifdef WIN32
# if defined(LIBSSH2_EXPORTS) || \
# if defined(LIBSSH2_EXPORTS) || defined(DLL_EXPORT) || \
defined(_WINDLL) || defined(libssh2_shared_EXPORTS)
# ifdef LIBSSH2_LIBRARY
# define LIBSSH2_API __declspec(dllexport)