github.com/notti/go-dynamic@v0.0.0-20190619201224-fc443047424c/internal/fakecgo/symbols_freebsd.go (about)

     1  package fakecgo
     2  
     3  import _ "unsafe" // for go:linkname
     4  
     5  // on BSDs we need the following (this is from runtime/cgo/freebsd.go)... which is not allowed outside cgo/stdlib :( - no way around that
     6  // Right now we can fix that with -gcflags=github.com/notti/nocgo/fakecgo=-std during build - but that doesn't seem to work with go test
     7  
     8  //go:linkname _environ environ
     9  //go:linkname _progname __progname
    10  
    11  //go:cgo_export_dynamic environ
    12  //go:cgo_export_dynamic __progname
    13  
    14  var _environ uintptr
    15  var _progname uintptr
    16  
    17  // we have to use the 3 argument format here :( - 2 argument format is only allowed from inside cgo
    18  
    19  //go:cgo_import_dynamic libc_pthread_attr_init_x pthread_attr_init "libpthread.so"
    20  //go:cgo_import_dynamic libc_pthread_attr_getstacksize_x pthread_attr_getstacksize "libpthread.so"
    21  //go:cgo_import_dynamic libc_pthread_attr_destroy_x pthread_attr_destroy "libpthread.so"
    22  //go:cgo_import_dynamic libc_pthread_sigmask_x pthread_sigmask "libpthread.so"
    23  //go:cgo_import_dynamic libc_pthread_create_x pthread_create "libpthread.so"
    24  //go:cgo_import_dynamic libc_pthread_detach_x pthread_detach "libpthread.so"
    25  //go:cgo_import_dynamic libc_setenv_x setenv "libc.so.7"
    26  //go:cgo_import_dynamic libc_unsetenv_x unsetenv "libc.so.7"
    27  //go:cgo_import_dynamic libc_malloc_x malloc "libc.so.7"
    28  //go:cgo_import_dynamic libc_free_x free "libc.so.7"
    29  //go:cgo_import_dynamic libc_nanosleep_x nanosleep "libc.so.7"
    30  //go:cgo_import_dynamic libc_sigfillset_x sigfillset "libc.so.7"
    31  //go:cgo_import_dynamic libc_abort_x abort "libc.so.7"
    32  //go:cgo_import_dynamic libc_dprintf_x dprintf "libc.so.7"
    33  //go:cgo_import_dynamic libc_strerror_x strerror "libc.so.7"
    34  //go:cgo_import_dynamic _ _ "libpthread.so"
    35  //go:cgo_import_dynamic _ _ "libc.so.7"