Unity3D issue : Passing 'long' to iOS plugin not supported

A long argument in an iOS plugin method call shifts all the values after it (where as works correctly on Android). For instance with the following method:

[DllImport ("__Internal")] public static extern void sendTimingImpl(string category, long intervalInMilliseconds, string nameStr, string label);

On the Unity3D C# side, if you call it like this :

#if UNITY_IPHONE
	sendTimingImpl("CATEGORY", 12345, "NAME", "LABEL");
#endif

Then on the Ojective-C side you get:

void sendTimingImpl(const char* category, long intervalInMilliseconds, const char* nameStr, const char* label) {
//category = "CATEGORY"
//intervalInMilliseconds = 12345
//nameStr = 0x0000000 (nil)
//label = "NAME"
}

=> The arguments after the long are screwed. You can reproduce it with long,long,long arguments for instance : only the first long will be valid, the second one will be 0 and the third one has the value of the second one. You can also reproduce it with a structure.

If you replace the long with an int, then everything works correctly. I suspect that Unity3D does not handle correctly the long values.

Have you already experienced the same issue? How you would solve it?

Thanks in advance,

Damien

Ok I’ve found a solution: using a int64_t variable instead of long in the C part:

void sendTimingImpl(const char* category, int64_t intervalInMilliseconds, const char* nameStr, const char* label) {
}

long type is 32bit in objective-c but 64bit in c#