mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
a8da601672
This is very useful for (conditionally) adding extra include paths relative to the package path.
31 lines
357 B
Go
31 lines
357 B
Go
package main
|
|
|
|
/*
|
|
// this name doesn't exist
|
|
#cgo NOFLAGS: -foo
|
|
|
|
// unknown flag
|
|
#cgo CFLAGS: -fdoes-not-exist -DNOTDEFINED
|
|
|
|
#cgo CFLAGS: -DFOO
|
|
|
|
#cgo CFLAGS: -Iinclude
|
|
#include "foo.h"
|
|
|
|
#if defined(FOO)
|
|
#define BAR 3
|
|
#else
|
|
#define BAR 5
|
|
#endif
|
|
|
|
#if defined(NOTDEFINED)
|
|
#warning flag must not be defined
|
|
#endif
|
|
*/
|
|
import "C"
|
|
|
|
var (
|
|
_ = C.BAR
|
|
_ = C.FOO_H
|
|
)
|