public IntPtr Init(string name, Func<NativeArray, NativeArray, int> cmp) {
// TODO: Complete member initialization
_cmp = cmp;
_namePinned = GCHandle.Alloc(
Encoding.ASCII.GetBytes(name),
GCHandleType.Pinned);
var thisHandle = GCHandle.Alloc(this);
var chandle = LevelDbInterop.leveldb_comparator_create(
GCHandle.ToIntPtr(thisHandle),
Marshal.GetFunctionPointerForDelegate(DestructorInstance),
Marshal.GetFunctionPointerForDelegate(CompareInstance),
Marshal.GetFunctionPointerForDelegate(NameAccessor));
if (chandle == default(IntPtr)) {
thisHandle.Free();
}
return chandle;
}