DaiMethodTracing icon indicating copy to clipboard operation
DaiMethodTracing copied to clipboard

arm64 下 crash 的問題

Open DaidoujiChen opened this issue 8 years ago • 0 comments

參考

重點節錄

Your Objective-C method is not variadic. Therefore any C implementation that you install using class_addMethod() must also be non-variadic. The call site (using the Objective-C method declaration) and the implementation (in your C function) must match. You must write a non-variadic C function to implement the non-variadic Objective-C method declaration, or you must write a variadic C function to implement a variadic Objective-C method declaration.

On arm64, variadic parameters and non-variadic parameters are passed differently. The expected result for a mismatch is undefined noise. Your reverse-order result is a coincidence and is likely to change with different code or compiler optimization. (This is true to some extent on some other architectures as well, but arm64 makes it even worse.)

固定參數數量的 IMP 只可以去接固定參數數量的 Method, 不固定參數數量的 IMP 只可以去接不固定參數數量的 Method, 亂接是不正確的行為.....

DaidoujiChen avatar Jun 28 '16 07:06 DaidoujiChen