Skip to content

Commit 35ec93c

Browse files
gbaralditopolarity
andcommitted
Set storage class of julia globals to dllimport on windows to avoid auto-import weirdness
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
1 parent fb457f2 commit 35ec93c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/codegen.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,12 @@ struct JuliaVariable {
493493
if (GlobalValue *V = m->getNamedValue(name))
494494
return cast<GlobalVariable>(V);
495495
auto T_size = m->getDataLayout().getIntPtrType(m->getContext());
496-
return new GlobalVariable(*m, _type(T_size),
496+
auto var = new GlobalVariable(*m, _type(T_size),
497497
isconst, GlobalVariable::ExternalLinkage,
498498
NULL, name);
499+
if (Triple(m->getTargetTriple()).isOSWindows())
500+
var->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::DLLImportStorageClass); // This is necessary to avoid auto import issues
501+
return var;
499502
}
500503
GlobalVariable *realize(jl_codectx_t &ctx);
501504
};

0 commit comments

Comments
 (0)