Exclude main methods from dllexport.

This commit is contained in:
Christoffer Lerno
2023-05-28 15:59:15 +02:00
parent e0cfb39d79
commit 9de02efa01
2 changed files with 2 additions and 1 deletions

View File

@@ -1061,7 +1061,7 @@ LLVMValueRef llvm_get_ref(GenContext *c, Decl *decl)
}
backend_ref = decl->backend_ref = LLVMAddFunction(c->module, decl_get_extname(decl), llvm_get_type(c, decl->type));
llvm_append_function_attributes(c, decl);
if (decl->is_export && platform_target.os == OS_TYPE_WIN32)
if (decl->is_export && platform_target.os == OS_TYPE_WIN32 && decl->name != kw_main && decl->name != kw_mainstub)
{
LLVMSetDLLStorageClass(backend_ref, LLVMDLLExportStorageClass);
}

View File

@@ -1,3 +1,4 @@
// #target: macos-x64
module cast_expr;
fn int main(int argc, char** argv)