From ac524eff0d1fd4a2362c7470befc88f5f71ca62b Mon Sep 17 00:00:00 2001 From: jbrodman Date: Thu, 4 Dec 2014 01:58:42 -0800 Subject: [PATCH] Add DLL storage class for export functions on windows --- module.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module.cpp b/module.cpp index 4102b31e..37c800e7 100644 --- a/module.cpp +++ b/module.cpp @@ -869,6 +869,13 @@ Module::AddFunctionDeclaration(const std::string &name, llvm::Function *function = llvm::Function::Create(llvmFunctionType, linkage, functionName.c_str(), module); + +#ifdef ISPC_IS_WINDOWS + // Make export functions callable from DLLS. + if (functionType->isExported) { + function->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + } +#endif // Set function attributes: we never throw exceptions function->setDoesNotThrow();