]> source.dussan.org Git - tigervnc.git/commitdiff
Use proper gnutls_free() on Windows
authorPierre Ossman <ossman@cendio.se>
Tue, 13 Aug 2024 13:53:07 +0000 (15:53 +0200)
committerLinn Mattsson <linma@cendio.se>
Fri, 18 Oct 2024 09:03:48 +0000 (11:03 +0200)
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 cfa4cc7dd223641176488dc3b41a53e6a81dade4)

common/rfb/CMakeLists.txt
common/rfb/CSecurityTLS.cxx

index 360434a9f1b4ba11b2b86805339a2e14d065585b..b67d1932cc649285789f978d89cfea84dbd2ada9 100644 (file)
@@ -101,6 +101,10 @@ if(GNUTLS_FOUND)
   target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx)
   target_include_directories(rfb SYSTEM PUBLIC ${GNUTLS_INCLUDE_DIR})
   target_link_libraries(rfb ${GNUTLS_LIBRARIES})
+  # FIXME: Hack to block it marking gnutls_free() as dllimport
+  if(WIN32 AND BUILD_STATIC)
+    target_compile_definitions(rfb PRIVATE GNUTLS_INTERNAL_BUILD)
+  endif()
 endif()
 
 if (NETTLE_FOUND)
index 11e6dfe3b4fc161806ded664324f14987f15862c..9a6489387d93de11ca4149c5fa56d00c0da9621e 100644 (file)
 
 #include <gnutls/x509.h>
 
-/*
- * GNUTLS doesn't correctly export gnutls_free symbol which is
- * a function pointer. Linking with Visual Studio 2008 Express will
- * fail when you call gnutls_free().
- */
-#if WIN32
-#undef gnutls_free
-#define gnutls_free free
-#endif
-
 using namespace rfb;
 
 static const char* configdirfn(const char* fn);