     #endif
     
     private static var isPythonLibraryPreloaded: Bool {
-        return self.loadSymbol(RTLD_DEFAULT, self.pythonInitializeSymbolName) != nil
+        return self.loadSymbol(self.defaultLibraryHandle, self.pythonInitializeSymbolName) != nil
     }
 
     static let libraryPaths: [String] = {

// The `PythonLibrary` struct that loads Python symbols at runtime.
//===----------------------------------------------------------------------===//

#if canImport(Darwin)
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
#else
let RTLD_DEFAULT: UnsafeMutableRawPointer? = nil
#endif

public struct PythonLibrary {
    private static let shared = PythonLibrary()
    private static let pythonInitializeSymbolName = "Py_Initialize"
    private static let pythonLegacySymbolName = "PyString_AsString"
    private static var librarySymbolsLoaded = false
    
    private let pythonLibraryHandle: UnsafeMutableRawPointer?
    private let isLegacyPython: Bool

        }
        return libraryPaths
    }()

    static func loadPythonLibrary() -> UnsafeMutableRawPointer? {
        if self.isPythonLibraryPreloaded {
            return self.defaultLibraryHandle
        }
        else if let pythonLibraryPath = Environment.library.value {
            return self.loadPythonLibrary(at: pythonLibraryPath)
