+/* returns a mangled name for a Win32 function using it's calling convention */
+ident *decorate_win32_c_fkt(entity *ent) {
+ type *tp = get_entity_type(ent);
+ unsigned cc_mask = get_entity_calling_convention(ent);
+ char buf[16];
+ int size, i;
+
+ if (IS_CDECL(cc_mask))
+ return mangle3("_", get_entity_ident(ent), "");
+ else if (IS_STDCALL(cc_mask)) {
+
+ size = 0;
+ for (i = get_method_n_params(tp) - 1; i >= 0; --i) {
+ size += get_type_size_bytes(get_method_param_type(tp, i));
+ }
+
+ snprintf(buf, sizeof(buf), "@%d", size);
+
+ if (cc_mask & irg_cc_reg_param)
+ return mangle3("@", get_entity_ident(ent), buf);
+ else
+ return mangle3("_", get_entity_ident(ent), buf);
+ }
+ return get_entity_ident(ent);
+}