There is a known efficiency in comparing two byte arrays in .Net by importing the memcmp function from msvcrt.dll , as described here .
Is there an equivalent library import in mono? Do I need to be different when running mono on linux or on windows? Or is there another quick byte comparison technique that works well in mono? I'm looking for something better than just looping through arrays in C #.
Update
Based on a comment by Matt Patenaude, I think this might work:
#if __MonoCS__ [DllImport("c", CallingConvention = CallingConvention.Cdecl)] #else [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)] #endif public static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);
But I have not tried it yet. I have never done p / invoke on mono before. I use the signature recommended by pinvoke.net . Will it be compatible?
Looking for a monophonic answer. Thanks.
Matt johnson
source share