summaryrefslogtreecommitdiff
path: root/adder.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-11-01 10:26:18 -0500
committerJeff Carr <[email protected]>2025-11-01 10:26:18 -0500
commita8ee202a434b6929a2f5488be5b1c0a0e10d6c02 (patch)
tree811b002d5e46b2ca223f403f425e9c5962519466 /adder.go
parent9e2da246d52558670685ffe86c25787b55c6b4a6 (diff)
example .c file on windowsHEADmasterdevel
Diffstat (limited to 'adder.go')
-rw-r--r--adder.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/adder.go b/adder.go
new file mode 100644
index 0000000..351a9f0
--- /dev/null
+++ b/adder.go
@@ -0,0 +1,23 @@
+package main
+
+
+/*
+#cgo CFLAGS: -DWIN32 -ID:/pg18headers -ID:/pg18headers/port/win32
+#cgo LDFLAGS: -LD:/pg18lib
+#include "postgres.h"
+#include "fmgr.h"
+
+
+// Forward declare the C function so cgo compiles add_two.c too.
+extern void init_add_two();
+*/
+import "C"
+
+
+//export Adder
+func Adder(a C.int32) C.int32 {
+ return a + 3
+}
+
+
+func main() {}