Misc existing (some nim-waku duplicates)
This commit is contained in:
parent
69b38671ca
commit
1ff392ef87
1
Makefile
1
Makefile
|
@ -5,6 +5,7 @@ build:
|
|||
|
||||
all: build
|
||||
|
||||
# TODO Integrate with nim-waku wrapper
|
||||
# TODO Assume we have libwaku.so already
|
||||
# libraries for dynamic linking of non-Nim objects
|
||||
EXTRA_LIBS_DYNAMIC := -L"$(CURDIR)/build" -lwaku -lm
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// Initialize Nim
|
||||
void NimMain();
|
||||
|
||||
char* info(const char* wakuNode);
|
||||
|
||||
void echo();
|
|
@ -0,0 +1,5 @@
|
|||
package
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
// TODO Update package name here
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
// Passing "-lwaku" to the Go linker through "-extldflags" is not enough. We need it in here, for some reason.
|
||||
#cgo LDFLAGS: -Wl,-rpath,'$ORIGIN' -L${SRCDIR}/../build -lwaku
|
||||
|
||||
#include "libwaku.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// Arrange that main.main runs on main thread.
|
||||
func init() {
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
|
||||
// Wrapper that uses C library instead
|
||||
|
||||
// Just call info here?
|
||||
func Start() {
|
||||
C.NimMain()
|
||||
var str = C.info("hello there")
|
||||
fmt.Println("String", str)
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hi main")
|
||||
Start()
|
||||
}
|
Loading…
Reference in New Issue