summaryrefslogtreecommitdiff
path: root/src/trans/codegen_c.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-07-09 12:10:08 +0800
committerJohn Hodge <tpg@mutabah.net>2017-07-09 12:10:08 +0800
commit1012c58e965d90cac0c89fd109a1595d52bd0a4b (patch)
tree792bfa9804c90411d19c02d7808991f4755d5b96 /src/trans/codegen_c.cpp
parente100e0aba56cbe84038f64be21c557981585dc30 (diff)
downloadmrust-1012c58e965d90cac0c89fd109a1595d52bd0a4b.tar.gz
Codegen C - Fix ABI for winapi functions, plan for overriding type representations in extern protos
Diffstat (limited to 'src/trans/codegen_c.cpp')
-rw-r--r--src/trans/codegen_c.cpp7
1 files changed, 6 insertions, 1 deletions
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;