Skip to content

Commit

Permalink
Set storage class of julia globals to dllimport on windows to avoid a…
Browse files Browse the repository at this point in the history
…uto-import weirdness

Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
  • Loading branch information
gbaraldi and topolarity committed May 24, 2024
1 parent fb457f2 commit 35ec93c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,12 @@ struct JuliaVariable {
if (GlobalValue *V = m->getNamedValue(name))
return cast<GlobalVariable>(V);
auto T_size = m->getDataLayout().getIntPtrType(m->getContext());
return new GlobalVariable(*m, _type(T_size),
auto var = new GlobalVariable(*m, _type(T_size),
isconst, GlobalVariable::ExternalLinkage,
NULL, name);
if (Triple(m->getTargetTriple()).isOSWindows())
var->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::DLLImportStorageClass); // This is necessary to avoid auto import issues
return var;
}
GlobalVariable *realize(jl_codectx_t &ctx);
};
Expand Down

0 comments on commit 35ec93c

Please sign in to comment.