2 coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
3 Understanding is not required. Only obedience.
5 This program is free software. It comes without any warranty, to
6 the extent permitted by applicable law. You can redistribute it
7 and/or modify it under the terms of the Do What The Fuck You Want
8 To Public License, Version 2, as published by Sam Hocevar. See
9 http://sam.zoy.org/wtfpl/COPYING for more details.
20 aName := aName + System suffixForDLL.
22 self error: 'can''t load library '+aName
30 self error: 'FfiLibrary should be created with #new:'
35 h := self loadLib: aName.
39 in: obj at: 2 put: aName.
53 h ifNotNil: [ self closeLib: h ].
62 ^loadSym: aLib name: aName [
63 <#FFIResolveName aLib aName>.
64 self error: 'can''t load value '+aName
68 self error: 'FfiValue should be created with #new:name:'
71 ^new: aLib name: aName [
73 h := self loadSym: aLib handle name: aName.
77 in: obj at: 2 put: aLib;
78 in: obj at: 3 put: aName.
84 func := lib := name := nil.
88 <#FFIGetVal func aType>.
97 ^loadSym: aLib name: aName [
98 <#FFIResolveName aLib aName>.
99 self error: 'can''t load function '+aName
103 self error: 'FfiFunction should be created with #new:name:'
106 ^new: aLib name: aName [
108 h := self loadSym: aLib handle name: aName.
109 obj := self basicNew.
111 in: obj at: 1 put: h;
112 in: obj at: 2 put: aLib;
113 in: obj at: 3 put: aName.
114 obj addToBeFinalized.
119 func := lib := name := nil.
124 self primitiveFailed.
128 <#FFICall func aType>.
129 self primitiveFailed.
133 Requires [ ffi/fficall ]