Source file src/runtime/cgo/library_linux.go
1 // Copyright 2026 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build goexperiment.cgobindings && !msan && !tsan && linux && !android 6 7 package cgo 8 9 // dlopen flags from <dlfcn.h> in glibc and musl. 10 const ( 11 _RTLD_NOW = 0x2 12 _RTLD_LOCAL = 0x0 13 14 dlopenFlags = _RTLD_NOW | _RTLD_LOCAL 15 ) 16 17 // Open is the only user of dlopen, dlsym, and dlerror, so link against 18 // libdl only when the cgobindings experiment is enabled. 19 20 //go:cgo_ldflag "-ldl" 21 22 //go:cgo_import_dynamic _cgo_libc_dlopen dlopen "libdl.so.2" 23 //go:cgo_import_dynamic _cgo_libc_dlsym dlsym "libdl.so.2" 24 //go:cgo_import_dynamic _cgo_libc_dlerror dlerror "libdl.so.2" 25