mercredi 14 octobre 2020

How to pass a delegate^ to a native class in c++/cli

I have a native class

public NativeClass:
{
public:
    typedef void(*Func)(cv::UMat image);

    void setFunc(Func func);
}

and could like pass a function as parameter from managed class.

ref ManagedClass:
{
    public:
        ManagedClass()
        {
           NativeClass* nativeClass = new NativeClass();
           nativeClass.setFunc(doSomething);
        }


    private:
        doSomething(cv::UMat image)
        {
            //do something
        }
}

But it seems doesn't work. Can someone help me? Thanks

Aucun commentaire:

Enregistrer un commentaire