Source file src/runtime/cgo/library_darwin.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 && darwin
     6  
     7  package cgo
     8  
     9  // dlopen flags from <dlfcn.h>. Unlike on most systems, dlopen defaults to
    10  // RTLD_GLOBAL if neither RTLD_LOCAL nor RTLD_GLOBAL is set, so RTLD_LOCAL
    11  // must be passed explicitly.
    12  const (
    13  	_RTLD_NOW   = 0x2
    14  	_RTLD_LOCAL = 0x4
    15  
    16  	dlopenFlags = _RTLD_NOW | _RTLD_LOCAL
    17  )
    18  
    19  // Open is the only user of dlopen, dlsym, and dlerror, so import them only
    20  // when the cgobindings experiment is enabled.
    21  
    22  //go:cgo_import_dynamic _cgo_libc_dlopen dlopen "/usr/lib/libSystem.B.dylib"
    23  //go:cgo_import_dynamic _cgo_libc_dlsym dlsym "/usr/lib/libSystem.B.dylib"
    24  //go:cgo_import_dynamic _cgo_libc_dlerror dlerror "/usr/lib/libSystem.B.dylib"
    25  

View as plain text