[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[S8FFI] errno

SwikiCodeRobot @> #testS8FFIErrno

"should set the errno with out-of-range strtoul value"
| libName lib fn result |
libName := NodeProcess platform = #win32 ifTrue: [#msvcrt] ifFalse: [#libc].
"self error: 'can Crash - in ffi_prep_cif_core'."
lib := S8FFI current library: libName functions: (
	#strtoul -> #(ulong #(string string int))
) lib: nil.
fn := lib handle basicAt: #strtoul.
result := fn
	value: '1234567890123456789012345678901234567890'
	value: nil json
	value: 0.
result = 34 ifFalse: [ self error: 'Bad error number = ',result ].