patch 9.1.0630: MS-Windows: build fails with VIMDLL and mzscheme

Problem:  MS-Windows: build fails with VIMDLL and mzscheme
Solution: define scheme_register_tls_space() inside gvim.exe
          and refer to it from the dll (Ken Takata).

`scheme_register_tls_space()` doesn't support a thread-local variable in
a DLL:
https://docs.racket-lang.org/inside/im_memoryalloc.html#%28cpp._scheme_register_tls_space%29

closes: #15363

Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ken Takata
2024-07-27 13:25:34 +02:00
committed by Christian Brabandt
parent 4100852e09
commit f0ce176b5f
5 changed files with 62 additions and 9 deletions

View File

@ -70,3 +70,24 @@ wmainCRTStartup(void)
}
# endif
#endif // USE_OWNSTARTUP
#if defined(VIMDLL) && defined(FEAT_MZSCHEME)
# if defined(_MSC_VER)
static __declspec(thread) void *tls_space;
extern intptr_t _tls_index;
# elif defined(__MINGW32__)
static __thread void *tls_space;
extern intptr_t _tls_index;
# endif
// Get TLS information that is needed for if_mzsch.
__declspec(dllexport) void
get_tls_info(void ***ptls_space, intptr_t *ptls_index)
{
*ptls_space = &tls_space;
*ptls_index = _tls_index;
return;
}
#endif