Skip to content

Commit 0d2e46e

Browse files
CendioOssmanLMattsson
authored andcommitted
Use proper gnutls_free() on Windows
The underlying issue requiring this hack was fixed ages ago. Unfortunately, the fixed GnuTLS doesn't consider static linking. So we need to add a new hack that permits that. (cherry picked from commit cfa4cc7)
1 parent 0db0c3d commit 0d2e46e

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

common/rfb/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ if(GNUTLS_FOUND)
101101
target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx)
102102
target_include_directories(rfb SYSTEM PUBLIC ${GNUTLS_INCLUDE_DIR})
103103
target_link_libraries(rfb ${GNUTLS_LIBRARIES})
104+
# FIXME: Hack to block it marking gnutls_free() as dllimport
105+
if(WIN32 AND BUILD_STATIC)
106+
target_compile_definitions(rfb PRIVATE GNUTLS_INTERNAL_BUILD)
107+
endif()
104108
endif()
105109

106110
if (NETTLE_FOUND)

common/rfb/CSecurityTLS.cxx

-10
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@
4646

4747
#include <gnutls/x509.h>
4848

49-
/*
50-
* GNUTLS doesn't correctly export gnutls_free symbol which is
51-
* a function pointer. Linking with Visual Studio 2008 Express will
52-
* fail when you call gnutls_free().
53-
*/
54-
#if WIN32
55-
#undef gnutls_free
56-
#define gnutls_free free
57-
#endif
58-
5949
using namespace rfb;
6050

6151
static const char* configdirfn(const char* fn);

0 commit comments

Comments
 (0)