import Foundation let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2) @_silgen_name("foo") func foo() {} let fooPtr = { dlsym(RTLD_DEFAULT, "foo")!.assumingMemoryBound(to: (() -> Void).self) }() fooPtr.pointee