diff --git a/internal/ffi/doc.go b/internal/ffi/doc.go index de4ccfe..c62b885 100644 --- a/internal/ffi/doc.go +++ b/internal/ffi/doc.go @@ -1,7 +1,9 @@ -// Package ffi groups the cgo bridges over the logos-delivery C libraries. +// Package ffi groups the cgo bridges over liblogosdelivery, the unified +// logos-delivery C library. // -// Each C library gets its own subpackage (libwaku now; liblogosdelivery in a -// follow-up) so that a binary links exactly the libraries it imports — the -// two .so files carry overlapping symbols and must never be linked together -// (until logos-delivery#3851 consolidates them). +// Each ABI gets its own subpackage — libwaku for the legacy waku_* Kernel API, +// liblogosdelivery for the logosdelivery_* Messaging API. Since +// logos-delivery#3949 merged the two libraries into one, both bridges link the +// same liblogosdelivery and may coexist in a single binary; the split is kept +// purely so callers import only the ABI they use. package ffi diff --git a/internal/ffi/liblogosdelivery/liblogosdelivery.go b/internal/ffi/liblogosdelivery/liblogosdelivery.go index 5f91d8a..d68e0de 100644 --- a/internal/ffi/liblogosdelivery/liblogosdelivery.go +++ b/internal/ffi/liblogosdelivery/liblogosdelivery.go @@ -4,9 +4,10 @@ // handle->handler registry, and exposes Go-typed primitives so the public // messaging package stays pure Go. // -// It links liblogosdelivery via a #cgo directive; it must never be linked into -// the same binary as the libwaku bridge (overlapping symbols) until -// logos-delivery#3851 consolidates the two libraries. +// It links liblogosdelivery via a #cgo directive. Since logos-delivery#3949 +// unified the libraries, liblogosdelivery exposes both the logosdelivery_* and +// the legacy waku_* ABIs, so this bridge and the libwaku bridge can safely +// share a binary. package liblogosdelivery /* diff --git a/internal/ffi/libwaku/libwaku.go b/internal/ffi/libwaku/libwaku.go index 2f5279e..37c628e 100644 --- a/internal/ffi/libwaku/libwaku.go +++ b/internal/ffi/libwaku/libwaku.go @@ -1,12 +1,16 @@ -// Package libwaku is the cgo bridge over libwaku (the legacy Kernel API -// library): the synchronous request/callback plumbing, the global event -// callback, and the handle registry. It exposes Go-typed primitives so -// pkg/kernel stays pure Go. +// Package libwaku is the cgo bridge over the legacy Kernel API (the waku_* +// ABI): the synchronous request/callback plumbing, the global event callback, +// and the handle registry. It exposes Go-typed primitives so pkg/kernel stays +// pure Go. +// +// Since logos-delivery#3949 the waku_* ABI ships inside the unified +// liblogosdelivery library (libwaku is gone), so this bridge links +// liblogosdelivery and includes its header. package libwaku /* -#cgo LDFLAGS: -lwaku -#include +#cgo LDFLAGS: -llogosdelivery +#include #include // wakuGoCallback (sync request/response) and wakuEventCallback (async events) @@ -57,8 +61,9 @@ static void cGoWakuVersion(void* ctx, void* resp) { } static void cGoWakuSetEventCallback(void* ctx) { // The ctx doubles as userData so the shared event callback can route the - // event to the right registered handler. - set_event_callback(ctx, (FFICallBack) wakuEventCallback, ctx); + // event to the right registered handler. Since logos-delivery#3949 both + // ABIs share the single logosdelivery_set_event_callback setter. + logosdelivery_set_event_callback(ctx, (FFICallBack) wakuEventCallback, ctx); } static void cGoWakuRelayPublish(void* ctx, const char* pubSubTopic, const char* jsonWakuMessage, int timeoutMs, void* resp) { waku_relay_publish(ctx, (FFICallBack) wakuGoCallback, resp, pubSubTopic, jsonWakuMessage, timeoutMs);