mirror of
https://github.com/logos-messaging/logos-messaging-go-bindings.git
synced 2026-07-05 10:19:29 +00:00
feat: link the unified liblogosdelivery from the cgo bridges
logos-delivery#3949 collapses libwaku into liblogosdelivery so a single C library exports both the waku_* and logosdelivery_* ABIs. Point the libwaku bridge at liblogosdelivery (header + -llogosdelivery) and route its event registration through logosdelivery_set_event_callback, since the waku-specific set_event_callback no longer exists. With one shared library the two bridges no longer carry overlapping symbols, so drop the "must not link together" caveats from the package docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5da314e0f7
commit
a618e09afe
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
/*
|
||||
|
||||
@ -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 <libwaku.h>
|
||||
#cgo LDFLAGS: -llogosdelivery
|
||||
#include <liblogosdelivery.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// 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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user