     
     log("Loading symbol '\(name)' from the Python library...")
     return unsafeBitCast(
-      dlsym(PythonLibrary.shared.pythonLibraryHandle, name),
+      loadSymbol(PythonLibrary.shared.pythonLibraryHandle, name),
       to: type
     )
   }

import Darwin
#elseif canImport(Glibc)
import Glibc
#endif

//===----------------------------------------------------------------------===//

    self.pythonLibraryHandle = pythonLibraryHandle
    
    // Check if Python is legacy (Python 2)
    isLegacyPython = PythonLibrary.loadSymbol(
      pythonLibraryHandle,
      PythonLibrary.pythonLegacySymbolName) != nil
    if isLegacyPython {
      PythonLibrary.log(
        "Loaded legacy Python library, using legacy symbols...")
    }
  }
  
  static func loadSymbol(
    _ libraryHandle: UnsafeMutableRawPointer, _ name: String
  ) -> UnsafeMutableRawPointer? {
    #if canImport(Darwin) || canImport(Glibc)
    return dlsym(libraryHandle, name)
    #elseif os(Windows)
    return GetProcAddress(libraryHandle, name)
    #endif
  }
  
  static func loadSymbol<T>(
