I have created a unity plugin for Windows Phone using C++ ,the windows phone runtime plugin has a function like:
static void random_string (unsigned char *outbuf, int buflen)
And then I need to assign the function to the delegate in unity script
So what kind of delegate I should declare in my unity script
You cannot do that. Function that is exported from Windows Phone C++ Plugin has to belong to a class in a namespace:
namespace NativePlugin
{
public ref class Plugin
{
public:
static Platform::String^ RandomString(int buflen); // static is only needed if you want to use the method without object instance
static void DoSomething(Platform::String^ str);
}
}
Then, in managed side you would call it like this:
var str = NativePlugin.Plugin.RandomString(5);
NativePlugin.Plugin.DoSomething(str);
If you really want to assign it to a delegate (I don’t know why would you do that, though), the delegates would look like this:
string RandomStringDelegate(int length);
void DoSomething(string str);