mirror of
https://github.com/vim/vim.git
synced 2025-10-25 09:04:09 -04:00
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:
committed by
Christian Brabandt
parent
4100852e09
commit
f0ce176b5f
@@ -383,7 +383,7 @@ static void (*dll_scheme_set_config_path)(Scheme_Object *p);
|
||||
# define scheme_null dll_scheme_null
|
||||
# define scheme_true dll_scheme_true
|
||||
|
||||
// pointers are GetProceAddress'ed as pointers to pointer
|
||||
// pointers are GetProcAddress'ed as pointers to pointer
|
||||
#if !defined(USE_THREAD_LOCAL) && !defined(LINK_EXTENSIONS_BY_TABLE)
|
||||
# define scheme_current_thread (*dll_scheme_current_thread_ptr)
|
||||
# endif
|
||||
@@ -924,7 +924,7 @@ mzscheme_end(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_TLS_SPACE
|
||||
#if HAVE_TLS_SPACE && !defined(VIMDLL)
|
||||
# if defined(_MSC_VER)
|
||||
static __declspec(thread) void *tls_space;
|
||||
extern intptr_t _tls_index;
|
||||
@@ -960,7 +960,24 @@ mzscheme_main(void)
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TLS_SPACE
|
||||
# ifdef VIMDLL
|
||||
void **ptls_space;
|
||||
intptr_t tls_index;
|
||||
void (*pget_tls_info)(void ***ptls_space, intptr_t *ptls_index);
|
||||
|
||||
// Get the address of get_tls_info() from (g)vim.exe.
|
||||
pget_tls_info = (void *)GetProcAddress(
|
||||
GetModuleHandle(NULL), "get_tls_info");
|
||||
if (pget_tls_info == NULL)
|
||||
{
|
||||
disabled = TRUE;
|
||||
return vim_main2();
|
||||
}
|
||||
pget_tls_info(&ptls_space, &tls_index);
|
||||
scheme_register_tls_space(ptls_space, tls_index);
|
||||
# else
|
||||
scheme_register_tls_space(&tls_space, _tls_index);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef TRAMPOLINED_MZVIM_STARTUP
|
||||
return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv);
|
||||
|
||||
Reference in New Issue
Block a user