Skip to content

Instantly share code, notes, and snippets.

@holys
Created August 12, 2014 03:14
Show Gist options
  • Select an option

  • Save holys/e2bae78ef1eb2bc9407c to your computer and use it in GitHub Desktop.

Select an option

Save holys/e2bae78ef1eb2bc9407c to your computer and use it in GitHub Desktop.
// +build leveldb hyperleveldb
package main
// #cgo leveldb CFLAGS: -DLEVELDB=1
// #cgo hyperleveldb CFLAGS: -DHYPERLEVELDB=1
// #include <stdio.h>
// void pp() {
// #ifdef LEVELDB
// printf("hello leveldb \n");
// #endif
// #ifdef HYPERLEVELDB
// printf("hello hyperleveldb\n");
// #endif
// }
import "C"
func main() {
C.pp()
}
//run
//go run -tags "leveldb" buildt.go
//output: hello leveldb
//go run -tags "hyperleveldb" buildt.go
//output: hello hyperleveldb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment