Skip to content

Commit 1ad6aed

Browse files
authored
Merge pull request #39052 from JuliaLang/sf/win_embedding_fixes
Various fixes to trampolines for embedding on Windows
2 parents ed9dde2 + 8981e0b commit 1ad6aed

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cli/loader_lib.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ JL_DLLEXPORT const char * jl_get_libdir()
130130

131131
void * libjulia_internal = NULL;
132132
__attribute__((constructor)) void jl_load_libjulia_internal(void) {
133+
// Only initalize this once
134+
if (libjulia_internal != NULL) {
135+
return;
136+
}
137+
133138
// Introspect to find our own path
134139
const char * lib_dir = jl_get_libdir();
135140

@@ -196,6 +201,8 @@ JL_DLLEXPORT int jl_load_repl(int argc, char * argv[]) {
196201

197202
#ifdef _OS_WINDOWS_
198203
int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved) {
204+
setup_stdio();
205+
199206
// Because we override DllMainCRTStartup, we have to manually call our constructor methods
200207
jl_load_libjulia_internal();
201208
return 1;

cli/trampolines/trampolines_x86_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.endef
1515
#define EXPORT(name) .section .drectve,"r"; \
1616
.ascii " -export:"#name""; \
17-
.section text
17+
.section .text
1818
#define SEH_START1(name) .seh_proc name
1919
#define SEH_START2() .seh_endprologue
2020
#define SEH_END() .seh_endproc

0 commit comments

Comments
 (0)