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

[coco8] JSCocoa Interface

We access native resources (ObjectiveC objects and C functions) from S8 side using an API implemented in ObjectiveC and assembly (for FFI calls).

The ObjectiveC classes and objects are seen in javascript space as normal javascript objects. We access the objects using NativeObject framework.

We implement ObjectiveC subclasses in S8 inheriting from NSObject.
When the system launch the subclasses of Coco8Implementation will try to find a native class (on ObjectiveC side) with the same name.

When application start execution, a Javascript Core environment is instantiated and the global space is modified to add access to native objects (in ObjectiveC space) from S8 system.
It is also read from XML file a set of symbols that area accessible to the s8 system from executable(C structures, functions and constants).


The original author of the implementation for Cocoa(ObjC) access was Patrick Geiller on 12/10/08. The interface use JavascriptCore library bindings published BEFORE iOS 7.0, and we have NOT migrated the library to new ObjectiveC API from Apple. At the time we got the sources from GIT repository, it was not working on iOS, and Ale implemented adaption of the FFI Assembly for iOS (for 32 and 64bits).
Coco8 platform now runs on iOS (32&64bits) and OSX (see xcode project s8sx).
The first releases of coco8 app embedded a custom version of the JSC library.
When Apple started promoting the use of the JSC library as a library for dynamic linking, we bound the application to the library dynamically and removed the old library from project.
The coco8 platform has grown on S8 side as usual, by iteration and incremental addition of features and bindings to iOS.

The Javascript Core was stable and robust until Apple published the new interface, but from that time up to now (July 2016) we have observed bugs and crash situations in places where there is no failure at smalltalk level; e.g. compiling classes (Collection recompileAll) in the device that do NOT require access to native objects.

We reported the bug to WebKit project.

See also