Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI: http://source.squeak.org/FFI/FFI-Kernel-mt.232.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.232 Author: mt Time: 17 April 2024, 11:17:11.319706 am UUID: 7bf5313f-0238-2541-97d4-daeeadc57839 Ancestors: FFI-Kernel-mt.231
For communicating failed FFI callouts, add support for PrimitiveError and ExceptionInFFICallError.
=============== Diff against FFI-Kernel-mt.231 ===============
Item was changed: ----- Method: ExternalFunction class>>externalCallFailedWith: (in category 'error handling') ----- externalCallFailedWith: primErrorCode "Raise an error after a failed call to an external function. The primFailCode could be any of: - a symbol; one of the standard primitive errors defined in Smalltalk primitiveErrorTable - nil; the VM does not support primitive errors and is not providing error codes - an integer; one of the FFI codes incremented by Smalltalk primitiveErrorTable size + 2 + so as not to clash with the standard primitive errors + - an instance of PrimitiveError that encodes an FFI marshalling error + - an instance of PrimitiveError that encodes an FFI callout exception error." + + primErrorCode isExceptionInFFICallError ifTrue: + [^self error: primErrorCode errorName, ' (', primErrorCode pc asString, ')']. + primErrorCode isPrimitiveError ifTrue: + [^self error: primErrorCode errorName, ' (', (self errorMessageFor: primErrorCode errorCode), ')']. + - so as not to clash with the standard primitive errors." ^self error: (primErrorCode isInteger ifTrue: [self errorMessageFor: primErrorCode - (Smalltalk primitiveErrorTable size + 2)] ifFalse: [primErrorCode isNil ifTrue: ['Call to external function failed'] ifFalse: [primErrorCode]])!
Item was added: + ----- Method: Object>>externalCallFailedWith: (in category '*FFI-Kernel') ----- + externalCallFailedWith: primErrorCode + + ^ ExternalFunction externalCallFailedWith: primErrorCode!
packages@lists.squeakfoundation.org