cd ~/Desktop/node npm install ffi
node n8.snapshot.js
JS @> (self require: #ffi)The API details of the library will be returned if all has worked as expected
Evaluate in the connected workspace the following expression |
| ffi libm | ffi := self require: #ffi. libm := ffi #Library: #libm value: (#ceil -> #(double #(double))) json. libm #ceil: 1.5 |
The result must be number 2 |
You can also access just functions in the current process e.g.: |
| ffi current | ffi := self require: #ffi. current := ffi #Library: nil json value: (#atoi -> #(int #(string))) json. current #atoi: #1234 |
The result must be number 1234 |
Smalltalk current eval: 'build/node/library/node-ffi/node-ffi.st.js' fileContents |
Note that the previous code will load the binary version of the framework, so after loading you can perform framework tests in your pie e.g. evaluating SwikiCodeRobot @> #(test S8FFI) |
git clone git://github.com/node-ffi/node-ffi.git cd node-ffi node-gyp rebuild