Skip to content

Commit

Permalink
Use proper gnutls_free() on Windows
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
CendioOssman authored and LMattsson committed Oct 18, 2024
1 parent 0db0c3d commit 0d2e46e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 4 additions & 0 deletions common/rfb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions common/rfb/CSecurityTLS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@

#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);
Expand Down

0 comments on commit 0d2e46e

Please sign in to comment.