From 1012c58e965d90cac0c89fd109a1595d52bd0a4b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 9 Jul 2017 12:10:08 +0800 Subject: Codegen C - Fix ABI for winapi functions, plan for overriding type representations in extern protos --- src/trans/codegen_c.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/trans/codegen_c.cpp') diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index a9f77d14..40bbddbb 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -2592,6 +2592,11 @@ namespace { ::HIR::TypeRef tmp; const auto& ret_ty = monomorphise_fcn_return(tmp, item, params); emit_ctype( ret_ty, FMT_CB(ss, + // TODO: Cleaner ABI handling + if( item.m_abi == "system" && m_compiler == Compiler::Msvc ) + { + ss << " __stdcall"; + } ss << " " << Trans_Mangle(p) << "("; if( item.m_args.size() == 0 ) { @@ -3915,7 +3920,7 @@ namespace { void emit_ctype(const ::HIR::TypeRef& ty) { emit_ctype(ty, FMT_CB(_,)); } - void emit_ctype(const ::HIR::TypeRef& ty, ::FmtLambda inner) { + void emit_ctype(const ::HIR::TypeRef& ty, ::FmtLambda inner, bool is_extern_c=false) { TU_MATCHA( (ty.m_data), (te), (Infer, m_of << "@" << ty << "@" << inner; -- cgit v1.2.3