The issue is that the type definition for all of the C-block types in the CocoaInt headers is wrong. It's defined as Pointer, but it should be a C-block procvar type. These are records, and are passed by value rather than by reference (so just passing @cblockvar won't work).
To fix this for individual cases, you'll need to redefine the relevant methods using correct parameter types. You can do so by creating a
category for the relevant class with a
method that has the correct signature. I.e., in this case, something like this (untested):
type
EKEventStoreRequestAccessCompletionHandler_Fixed = reference to Procedure(granted: ObjCBOOL; error: NSError); cdecl; cblock;
EKEventStore_FixedMethods = objccategory(EKEventStore)
procedure requestAccessToEntityType_completion_fixed (entityType: EKEntityType; completion: EKEventStoreRequestAccessCompletionHandler_Fixed); message 'requestAccessToEntityType:completion:';
end;
And then call requestAccessToEntityType_completion_fixed instead of requestAccessToEntityType_completion.
It would be very nice if someone could take responsibility to fixing and maintaining the Cocoa headers, because the original creator hasn't done so for quite a while and never added support for blocks after the compiler got support for it. You can find the converter used to create the header translations at
https://github.com/genericptr/Framework-Parser