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();