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

[jx8-ios] Extending jxcore with internal module for s8

This page contain description of changes made to jxcore to add an internal binding to implement direct access to FFI.

Adding module files to project

  1. New folder for source files at src/s8
  2. Add two files (s8_ffi.h and s8_ffi.cc) for sources of s8-ffi module at src/s8
  3. Add a new line to file node_extensions.h to register node_s8_ffi module in (internal) node extensions list
  4. Add 'src/s8/s8_ffi.cc' to jx.gpy after line 'src/wrappers/node_zlib.cc'; to ensure our module will be included in build

Building the jxcore

  1. Open terminal window and cd to root of jxcore project folder
  2. execute build script
    ./build_scripts/ios_compile.sh
  3. it is not smalltalk, so relax and wait the build to finish

Installing the new jxcore engine

  1. copy the folders (bin and include) under out_ios/ios to jx8-ios project under jx8-ios/jxcore

Running jx8-ios and accessing our new s8 binding

  1. Run jx8-ios in the device with xcode debug
  2. Connect a workspace from desktop U8 contribution
  3. To access the s8 library evaluate with showIt
  4. To see the methods published by the library evaluate with showIt

Initializing the bindings

| obj cif nargs rtype atypes abi |
obj := Object new json.
(NodeJS process handle #binding: #s8_ffi)
	#initializeBindings: obj.
JS@>obj['FFI_TYPES'].
JS@>obj['StaticFunctions'][#dlopen].
{'cif = new Buffer("hello");'}.
nargs := 0.
rtype := #void.
atypes := #aTypes.
abi := 1.
obj	#ffi_prep_cif: cif
	nargs: nargs
	rtype: rtype
	atypes: atypes
	abi: abi