summaryrefslogtreecommitdiffstats
path: root/src/if_mzsch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_mzsch.c')
-rw-r--r--src/if_mzsch.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/if_mzsch.c b/src/if_mzsch.c
index 9a9c487..4a8644c 100644
--- a/src/if_mzsch.c
+++ b/src/if_mzsch.c
@@ -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);