Hello, Does anyone know if cblocks are working for darwin-aarch64?
I'm trying to use GCController objects. The notification is based of blocks. The code looks like this: GCExtendedGamepad.inc ---- {$modeswitch cblocks} type GCExtendedGamepadValueChangedHandler = reference to procedure (gamepad: GCGamepad; element: GCControllerElement); cdecl; type GCExtendedGamepad = objcclass external (NSObject) public ... procedure setValueChangedHandler(newValue: GCExtendedGamepadValueChangedHandler); message 'setValueChangedHandler:'; ... end; --- maincode.pas --- {$modeswitch cblocks} ... procedure extendedGamePadChange(gamepad: GCGamepad; element: GCControllerElement); // calling convention cdecl is not specified begin writeln('something changed'); end; ... // gc is GCController - it's a valid object // gc.extendedGamepad - exists and is avalid object gc.extendedGamepad.setValueChangedHandler(@extendedGamePadChange); ---- The problem is that code seems to be failing on "setValueCahngeHandler" call. libobjc.A.dylib`objc_msgSend: 0x2469fa80 <+0>: cbz r0, 0x2469fabe ; <+62> 0x2469fa82 <+2>: ldr.w r9, [r0] -> 0x2469fa86 <+6>: ldrh.w r12, [r9, #0xc] ; EXC_BAD_ACCESS 0x2469fa8a <+10>: ldr.w r9, [r9, #0x8] 0x2469fa8e <+14>: and.w r12, r12, r1 0x2469fa92 <+18>: add.w r9, r9, r12, lsl #3 0x2469fa96 <+22>: ldr.w r12, [r9] 0x2469fa9a <+26>: teq.w r12, r1 0x2469fa9e <+30>: bne 0x2469faa6 ; <+38> 0x2469faa0 <+32>: ldr.w r12, [r9, #0x4] 0x2469faa4 <+36>: bx r12 0x2469faa6 <+38>: cmp.w r12, #0x1 0x2469faaa <+42>: blo 0x2469fab8 ; <+56> 0x2469faac <+44>: it eq 0x2469faae <+46>: ldreq.w r9, [r9, #0x4] 0x2469fab2 <+50>: ldr r12, [r9, #8]! 0x2469fab6 <+54>: b 0x2469fa9a ; <+26> 0x2469fab8 <+56>: ldr.w r9, [r0] 0x2469fabc <+60>: b 0x2469fd00 ; _objc_msgSend_uncached 0x2469fabe <+62>: mov.w r1, #0x0 0x2469fac2 <+66>: mov.w r2, #0x0 0x2469fac6 <+70>: mov.w r3, #0x0 0x2469faca <+74>: bx lr 0x2469facc <+76>: nop 0x2469face <+78>: nop 0x2469fad0 <+80>: nop 0x2469fad2 <+82>: nop 0x2469fad4 <+84>: nop 0x2469fad6 <+86>: nop 0x2469fad8 <+88>: nop 0x2469fada <+90>: nop 0x2469fadc <+92>: nop 0x2469fade <+94>: nop I wonder if it's related to aarch64, is block parameter passed incorrectly?. I'm also using fpc-trunk some 2015-Nov revision. Should I just update to the latest fpc revision? thanks, Dmitry
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel