]> 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)
committerPierre Ossman <ossman@cendio.se>
Tue, 13 Aug 2024 13:53:07 +0000 (15:53 +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.

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

index d7fb3f3a8cdee5af769f3fb7323266b103eecea8..365354484be50a721c5ad7ff3e37a9959bc5140a 100644 (file)
@@ -100,6 +100,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 eca1ea7408d7c3120d360b8a78455b72bb329513..2a7a117948390430c9711d97e22ed348969f7f5b 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);