cgo.go raw

   1  // SPDX-License-Identifier: Apache-2.0
   2  // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
   3  
   4  //go:build cgo && (darwin || freebsd || linux || netbsd)
   5  
   6  package purego
   7  
   8  // if CGO_ENABLED=1 import the Cgo runtime to ensure that it is set up properly.
   9  // This is required since some frameworks need TLS setup the C way which Go doesn't do.
  10  // We currently don't support ios in fakecgo mode so force Cgo or fail
  11  // Even if CGO_ENABLED=1 the Cgo runtime is not imported unless `import "C"` is used.
  12  // which will import this package automatically. Normally this isn't an issue since it
  13  // usually isn't possible to call into C without using that import. However, with purego
  14  // it is since we don't use `import "C"`!
  15  import (
  16  	_ "runtime/cgo"
  17  
  18  	_ "github.com/ebitengine/purego/internal/cgo"
  19  )
  20