Created
April 9, 2015 14:02
-
-
Save vbatts/d3586e703147c6797a69 to your computer and use it in GitHub Desktop.
FORTIFY_SOURCE
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
#!/bin/sh | |
# build and see output | |
go build -x c.go | |
# if you link to outside libraries | |
#go build -ldflags '-extldflags "-DFORTIFY_SOURCE"' -x c.go |
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: -DFORTIFY_SOURCE | |
#include <stdio.h> | |
void foo(const char* msg) { | |
printf(msg); | |
} | |
*/ | |
import "C" | |
func main() { | |
C.foo(C.CString("whoop whoop\n")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment