Last active
November 11, 2016 23:50
-
-
Save Perelandric/133e3e1fa3d35cc9d1d371f3ef1627f1 to your computer and use it in GitHub Desktop.
Statically link to pony library from Go project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
#cgo CFLAGS: -I${SRCDIR}/lib | |
#cgo CFLAGS: -I$PONYHOME/src/libponyrt/ | |
#cgo LDFLAGS: ${SRCDIR}/lib/libtest.a | |
#cgo LDFLAGS: -L$PONYHOME/build/release -lponyrt | |
#cgo LDFLAGS: -lpthread | |
#cgo LDFLAGS: -ldl | |
#include "pony.h" | |
#include "lib/test.h" | |
*/ | |
import "C" | |
import ( | |
"time" | |
"unsafe" | |
) | |
func main() { | |
// Initialize | |
const argc = 1 | |
var argv = [argc]*C.char{C.CString("test")} | |
C.pony_init(argc, unsafe.Pointer(&argv)) | |
// Create actor and arg | |
var t = C.Test_Alloc() | |
var str = C.CString("test") | |
// Call constructor with string | |
C.Test_tag_create_oo__send(t, str) | |
C.pony_start(true) | |
// Wait a second | |
time.Sleep(time.Second) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actor @Test | |
new create(s:Pointer[U8] tag) => | |
None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some
gdb
info: