From 13f084a219320a39eaa06dc4527f720231cc9710 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 8 Dec 2018 11:45:08 +0000 Subject: [PATCH] Fix `foreign export` #294 --- examples/demo/demo.odin | 8 +++++++- src/ir.cpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 9fc6db2a8..5f4f0dfb2 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -836,8 +836,14 @@ diverging_procedures :: proc() { foo(); } +foreign export { + bar :: proc "c" () -> i32 { + return 123; + } +} + main :: proc() { - when true { + when false { general_stuff(); union_type(); parametric_polymorphism(); diff --git a/src/ir.cpp b/src/ir.cpp index ea7719af2..77587516d 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -9744,6 +9744,7 @@ void ir_gen_tree(irGen *s) { irValue *p = ir_value_procedure(m, e, e->type, type_expr, body, name); p->Proc.tags = pl->tags; p->Proc.inlining = pl->inlining; + p->Proc.is_export = e->Procedure.is_export; ir_module_add_value(m, e, p); HashKey hash_name = hash_string(name);