Commit 5483ea9e authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Support non-default calling conventions for object methods.

parent fe7e786a
...@@ -729,10 +729,12 @@ static void write_cpp_method_def(const type_t *iface) ...@@ -729,10 +729,12 @@ static void write_cpp_method_def(const type_t *iface)
{ {
var_t *def = cur->def; var_t *def = cur->def;
if (!is_callas(def->attrs)) { if (!is_callas(def->attrs)) {
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "";
indent(header, 0); indent(header, 0);
fprintf(header, "virtual "); fprintf(header, "virtual ");
write_type_decl_left(header, get_func_return_type(cur)); write_type_decl_left(header, get_func_return_type(cur));
fprintf(header, " STDMETHODCALLTYPE "); fprintf(header, " %s ", callconv);
write_name(header, def); write_name(header, def);
fprintf(header, "(\n"); fprintf(header, "(\n");
write_args(header, cur->args, iface->name, 2, TRUE); write_args(header, cur->args, iface->name, 2, TRUE);
...@@ -755,9 +757,11 @@ static void do_write_c_method_def(const type_t *iface, const char *name) ...@@ -755,9 +757,11 @@ static void do_write_c_method_def(const type_t *iface, const char *name)
{ {
const var_t *def = cur->def; const var_t *def = cur->def;
if (!is_callas(def->attrs)) { if (!is_callas(def->attrs)) {
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "";
indent(header, 0); indent(header, 0);
write_type_decl_left(header, get_func_return_type(cur)); write_type_decl_left(header, get_func_return_type(cur));
fprintf(header, " (STDMETHODCALLTYPE *"); fprintf(header, " (%s *", callconv);
write_name(header, def); write_name(header, def);
fprintf(header, ")(\n"); fprintf(header, ")(\n");
write_args(header, cur->args, name, 1, TRUE); write_args(header, cur->args, name, 1, TRUE);
...@@ -787,9 +791,11 @@ static void write_method_proto(const type_t *iface) ...@@ -787,9 +791,11 @@ static void write_method_proto(const type_t *iface)
const var_t *def = cur->def; const var_t *def = cur->def;
if (!is_local(def->attrs)) { if (!is_local(def->attrs)) {
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "";
/* proxy prototype */ /* proxy prototype */
write_type_decl_left(header, get_func_return_type(cur)); write_type_decl_left(header, get_func_return_type(cur));
fprintf(header, " CALLBACK %s_", iface->name); fprintf(header, " %s %s_", callconv, iface->name);
write_name(header, def); write_name(header, def);
fprintf(header, "_Proxy(\n"); fprintf(header, "_Proxy(\n");
write_args(header, cur->args, iface->name, 1, TRUE); write_args(header, cur->args, iface->name, 1, TRUE);
......
...@@ -253,10 +253,12 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, ...@@ -253,10 +253,12 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
var_t *def = cur->def; var_t *def = cur->def;
int has_ret = !is_void(get_func_return_type(cur)); int has_ret = !is_void(get_func_return_type(cur));
int has_full_pointer = is_full_pointer_function(cur); int has_full_pointer = is_full_pointer_function(cur);
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
if (!callconv) callconv = "";
indent = 0; indent = 0;
write_type_decl_left(proxy, get_func_return_type(cur)); write_type_decl_left(proxy, get_func_return_type(cur));
print_proxy( " STDMETHODCALLTYPE %s_", iface->name); print_proxy( " %s %s_", callconv, iface->name);
write_name(proxy, def); write_name(proxy, def);
print_proxy( "_Proxy(\n"); print_proxy( "_Proxy(\n");
write_args(proxy, cur->args, iface->name, 1, TRUE); write_args(proxy, cur->args, iface->name, 1, TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment