Skip to content

asadovsky/cgotest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cgotest

Prototype of Swift-to-Go bridge, using Cgo.

Subsequent work, including Java-to-Go bridge:

Building and running

First, install the v23:base profile for amd64-ios and arm64-ios:

jiri profile install -target=amd64-ios v23:base
jiri profile install -target=arm64-ios v23:base

Next, build the Cgo shared libraries:

make build-ios

Finally, open the CgoSwift project in Xcode and run the tests.

Design

Async, non-streaming:

  • Swift function F accepts callback B
  • F uses GCD to dispatch the Cgo function on a non-main queue
  • When the Cgo function returns, we dispatch B on the main queue

Async, streaming:

  • Swift function F accepts callback B
  • F uses GCD to dispatch the Cgo function on a non-main queue, passing it a C-style callback that curries a handle to B
  • When the C-style callback gets invoked, we retrieve B (via the handle) and dispatch it on the main queue

In both cases, we can also make the callback queue configurable instead of always using the main queue.

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published