mirror of
https://github.com/logos-messaging/logos-messaging-go-bindings.git
synced 2026-07-24 12:03:12 +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
|
// Each ABI gets its own subpackage — libwaku for the legacy waku_* Kernel API,
|
||||||
// follow-up) so that a binary links exactly the libraries it imports — the
|
// liblogosdelivery for the logosdelivery_* Messaging API. Since
|
||||||
// two .so files carry overlapping symbols and must never be linked together
|
// logos-delivery#3949 merged the two libraries into one, both bridges link the
|
||||||
// (until logos-delivery#3851 consolidates them).
|
// same liblogosdelivery and may coexist in a single binary; the split is kept
|
||||||
|
// purely so callers import only the ABI they use.
|
||||||
package ffi
|
package ffi
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
// handle->handler registry, and exposes Go-typed primitives so the public
|
// handle->handler registry, and exposes Go-typed primitives so the public
|
||||||
// messaging package stays pure Go.
|
// messaging package stays pure Go.
|
||||||
//
|
//
|
||||||
// It links liblogosdelivery via a #cgo directive; it must never be linked into
|
// It links liblogosdelivery via a #cgo directive. Since logos-delivery#3949
|
||||||
// the same binary as the libwaku bridge (overlapping symbols) until
|
// unified the libraries, liblogosdelivery exposes both the logosdelivery_* and
|
||||||
// logos-delivery#3851 consolidates the two libraries.
|
// the legacy waku_* ABIs, so this bridge and the libwaku bridge can safely
|
||||||
|
// share a binary.
|
||||||
package liblogosdelivery
|
package liblogosdelivery
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
// Package libwaku is the cgo bridge over libwaku (the legacy Kernel API
|
// Package libwaku is the cgo bridge over the legacy Kernel API (the waku_*
|
||||||
// library): the synchronous request/callback plumbing, the global event
|
// ABI): the synchronous request/callback plumbing, the global event callback,
|
||||||
// callback, and the handle registry. It exposes Go-typed primitives so
|
// and the handle registry. It exposes Go-typed primitives so pkg/kernel stays
|
||||||
// pkg/kernel stays pure Go.
|
// 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
|
package libwaku
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo LDFLAGS: -lwaku
|
#cgo LDFLAGS: -llogosdelivery
|
||||||
#include <libwaku.h>
|
#include <liblogosdelivery.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// wakuGoCallback (sync request/response) and wakuEventCallback (async events)
|
// wakuGoCallback (sync request/response) and wakuEventCallback (async events)
|
||||||
@ -57,8 +61,9 @@ static void cGoWakuVersion(void* ctx, void* resp) {
|
|||||||
}
|
}
|
||||||
static void cGoWakuSetEventCallback(void* ctx) {
|
static void cGoWakuSetEventCallback(void* ctx) {
|
||||||
// The ctx doubles as userData so the shared event callback can route the
|
// The ctx doubles as userData so the shared event callback can route the
|
||||||
// event to the right registered handler.
|
// event to the right registered handler. Since logos-delivery#3949 both
|
||||||
set_event_callback(ctx, (FFICallBack) wakuEventCallback, ctx);
|
// 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) {
|
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);
|
waku_relay_publish(ctx, (FFICallBack) wakuGoCallback, resp, pubSubTopic, jsonWakuMessage, timeoutMs);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user