Documentation
¶
Overview ¶
Package main is the C-archive surface that embeds the `any` engine in an iOS app. Built with `-tags mobile -buildmode=c-archive` it links the full embedded dependency graph (any-sync + libp2p + QUIC + the modernc SQLite shim) and exposes five C entry points the Swift side calls over its lifecycle: AnyLibStart, AnyLibStartWithMode, AnyLibStop, AnyLibStopNow and AnyLibVersion.
It lives under mobile/ rather than cmd/ because cmd/ is Go's convention for runnable binaries and a c-archive is not one — the Android gomobile shim sits beside it at mobile/android.
All real lifecycle logic lives in internal/embedded — the shared, build-tag-free core both mobile shims sit on. This package is a thin host-idiom adapter: the //export wrappers only marshal C<->Go types and translate the core's typed errors to the C codes the Swift side mirrors. The plain Go functions (startEngine / stopEngine / errCode / copyBounded) carry that translation and are what the host-build test suite exercises; the //export wrappers themselves cannot be called from `go test`, and neither can anything typed in terms of C (cgo is not permitted in _test.go). That's why the core below is pure Go and the cgo layer is a two-line adapter over it.