From abe3588e56850403f7ebaf3c9090552e5f4830c6 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 19 Sep 2022 16:19:01 +0200 Subject: Exports: Simplify building - Remove subdir c - Do not compile c code as a separate shared library - Move all definitions/declarations into the preamble as they shouldn't be shared anyways. So no headers are needed - Define the callback as static, needed so we don't get a duplicate declaration --- exports/exports.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'exports/exports.go') diff --git a/exports/exports.go b/exports/exports.go index 0144500..4f0b865 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -1,13 +1,14 @@ package main /* -#cgo CFLAGS: -I${SRCDIR}/c -#cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/c -#cgo LDFLAGS: -L${SRCDIR}/c -#cgo LDFLAGS: -lcommon - #include -#include "c/common.h" + +typedef void (*PythonCB)(const char* name, int oldstate, int newstate, void* data); + +static void call_callback(PythonCB callback, const char *name, int oldstate, int newstate, void* data) +{ + callback(name, oldstate, newstate, data); +} */ import "C" -- cgit v1.2.3