c++/cli pass (managed) delegate to unmanaged code

Yes, you want Marshal::GetFunctionPointerForDelegate(). Your code snippet is missing the managed function you’d want to call, I just made one up. You will also have to declare the managed delegate type and create an instance of it before you can get a function pointer. This worked well: #include “stdafx.h” using namespace System; using namespace System::Runtime::InteropServices; … Read more

Delegates in swift?

Delegates always confused me until I realized that a delegate is just a class that does some work for another class. It’s like having someone else there to do all the dirty work for you that you don’t want to do yourself. I wrote a little story to illustrate this. Read it in a Playground … Read more