diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2013-04-25 07:58:54 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-04-25 08:00:09 +0100 |
commit | 8b3a13129a3976c586f99c93dd8766e93c1211cf (patch) | |
tree | e1778bac626d5197379972f815a4ff1d8185ea34 | |
parent | 51eabad1d598146f8ad2ccb8dd28eb173df729b8 (diff) | |
download | swig-8b3a13129a3976c586f99c93dd8766e93c1211cf.tar.gz |
Further MonoTouch / Xamarin.iOS support - for directors.
Needs testing - it may not work due to the use of non-static delegate methods which are unsupported in MonoTouch.
-rw-r--r-- | Source/Modules/csharp.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 0d15a9c1d..c019b8442 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -3478,6 +3478,8 @@ public: String *callback_code = NewString(""); String *imcall_args = NewString(""); bool ignored_method = GetFlag(n, "feature:ignore") ? true : false; + UpcallData *udata = 0; + String *methid = 0; // Kludge Alert: functionWrapper sets sym:overload properly, but it // isn't at this point, so we have to manufacture it ourselves. At least @@ -3488,6 +3490,12 @@ public: qualified_return = SwigType_rcaststr(returntype, "c_result"); + if (!ignored_method) { + udata = addUpcallMethod(imclass_dmethod, symname, decl, overloaded_name); + methid = Getattr(udata, "class_methodidx"); + Setattr(n, "upcalldata", udata); + } + if (!is_void && !ignored_method) { if (!SwigType_isclass(returntype)) { if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) { @@ -3548,9 +3556,12 @@ public: Printf(director_delegate_definitions, " %s\n", im_directoroutattributes); } - Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name); - if (!ignored_method) + if (!ignored_method) { + Printf(callback_def, " [%s.MonoPInvokeCallback(typeof(SwigDelegate%s_%s))]\n", imclass_name, classname, methid); + Printf(director_delegate_definitions, " [%s.MonoNativeFunctionWrapper]\n", imclass_name); Printf(director_delegate_definitions, " public delegate %s", tm); + } + Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name); } else { Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(returntype, 0)); } @@ -3903,13 +3914,6 @@ public: if (!ignored_method) { /* Emit the actual upcall through */ - UpcallData *udata = addUpcallMethod(imclass_dmethod, symname, decl, overloaded_name); - String *methid = Getattr(udata, "class_methodidx"); - Setattr(n, "upcalldata", udata); - /* - Printf(stdout, "setting upcalldata, nodeType: %s %s::%s %p\n", nodeType(n), classname, Getattr(n, "name"), n); - */ - Printf(director_callback_typedefs, " typedef %s (SWIGSTDCALL* SWIG_Callback%s_t)(", c_ret_type, methid); Printf(director_callback_typedefs, "%s);\n", callback_typedef_parms); Printf(director_callbacks, " SWIG_Callback%s_t swig_callback%s;\n", methid, overloaded_name); |