Add DLL storage class for export functions on windows

This commit is contained in:
jbrodman
2014-12-04 01:58:42 -08:00
parent 56c78e55d5
commit ac524eff0d

View File

@@ -869,6 +869,13 @@ Module::AddFunctionDeclaration(const std::string &name,
llvm::Function *function = llvm::Function *function =
llvm::Function::Create(llvmFunctionType, linkage, functionName.c_str(), llvm::Function::Create(llvmFunctionType, linkage, functionName.c_str(),
module); 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 // Set function attributes: we never throw exceptions
function->setDoesNotThrow(); function->setDoesNotThrow();