Created
April 30, 2025 21:33
-
-
Save jacobsapps/50813a2fead9dbba2f8171d5a082ae46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Darwin | |
func loadFramework(at path: String) throws -> UnsafeMutableRawPointer? { | |
guard let handle = dlopen(path, RTLD_NOW) else { | |
if let error = dlerror() { | |
throw NSError(domain: "dlopen", code: 1, userInfo: [NSLocalizedDescriptionKey: String(cString: error)]) | |
} | |
throw NSError(domain: "dlopen", code: 2, userInfo: [NSLocalizedDescriptionKey: "Unknown error"]) | |
} | |
return handle | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment