Skip to content

Instantly share code, notes, and snippets.

@Gustav-Simonsson
Created February 18, 2015 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gustav-Simonsson/2b104de5f649224c68ae to your computer and use it in GitHub Desktop.
Save Gustav-Simonsson/2b104de5f649224c68ae to your computer and use it in GitHub Desktop.
small cgo example
package secp256k1
/*
#include "./secp256k1/include/secp256k1.h"
*/
import "C"
import ()
func main() {
C.secp256k1_start() //takes 10ms to 100ms
C.secp256k1_stop()
}
@Gustav-Simonsson
Copy link
Author

> go build foo.go 
# command-line-arguments
/tmp/go-build751837135/command-line-arguments/_obj/foo.cgo2.o: In function `_cgo_6ef1d538b2ea_Cfunc_secp256k1_start':
./foo.go:37: undefined reference to `secp256k1_start'
/tmp/go-build751837135/command-line-arguments/_obj/foo.cgo2.o: In function `_cgo_6ef1d538b2ea_Cfunc_secp256k1_stop':
./foo.go:46: undefined reference to `secp256k1_stop'
collect2: error: ld returned 1 exit status
```bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment