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

test[S8FFI] DynamicLibrary

SwikiCodeRobot @> #testS8FFIDynamicLibrary

"instantiation test"
| libName lib |
libName := NodeProcess platform = #win32 ifTrue: [#msvcrt] ifFalse: [#libc].
lib := S8FFI current dynamicLibrary: libName ,S8FFI libExt mode: nil.
(lib isKindOf: FFIDynamicLibrary) ifFalse: [
	self error: 'Invalid instance'
].

"should return a pointer Buffer to a symbol"
| libName lib symbol |
libName := NodeProcess platform = #win32 ifTrue: [#msvcrt] ifFalse: [#libc].
lib := S8FFI current dynamicLibrary: libName ,S8FFI libExt mode: nil.
symbol := lib get: #free.
symbol isNil ifTrue: [ self error: 'Symbol not found' ].
symbol size = 0 ifFalse: [ self error: 'Invalid symbol length' ].