I was starting to feel embarrass about this, it is almost like nothing was making sense.
- Code: Select all
public delegate void ProgressCallbackGlue();
namespace NewtonPlugin
{
abstract public class NewtonCollider : MonoBehaviour
{
public void TestCallback()
{
UnityEngine.Debug.Log("calling call back xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
I now finally figured out what my problem was.
basically I was declaring the delegate inside the namespace, once I did that not matter what I did swig could not figure out how to map the c# function to a cpp function, even if I did it correct following the instructions for delegate declaration the names where different.
Swig map c# type to C types, basically is using this macro
- Code: Select all
%define %cs_callback(TYPE, CSTYPE)
%typemap(ctype) TYPE, TYPE& "void*"
%typemap(in) TYPE %{ $1 = ($1_type)$input; %}
%typemap(in) TYPE& %{ $1 = ($1_type)&$input; %}
%typemap(imtype, out="IntPtr") TYPE, TYPE& "CSTYPE"
%typemap(cstype, out="IntPtr") TYPE, TYPE& "CSTYPE"
%typemap(csin) TYPE, TYPE& "$csinput"
%enddef
%cs_callback(ProgressCallbackGlue, ProgressCallbackGlue)
I found over the swig mailing list, but I could no get it to work because name space, ideally it should be
%cs_callback(ProgressCallbackGlue, NewtonPlugin::ProgressCallbackGlue)
but it does not work, so after three days of trial an errors, but chance I moved the define outside the name space and now is worked.
I check in a test function that only print a massage, now I will see if it can print some data for the class, and of that works we can now make progress.
BTW I do not think that %feature ("director") is for call back stuff. but anyone I hope this is the last for the obstacles.
if you have time, please check it out see if this is correct.