Created
June 19, 2015 22:49
-
-
Save russbishop/bdcd22e277fa957162d5 to your computer and use it in GitHub Desktop.
dylib from Swift
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
typealias verFunc = @convention(c) ()->UnsafePointer<CChar> | |
let libz = dlopen("libz.dylib", RTLD_LAZY) | |
let ret = dlsym(libz, "zlibVersion") | |
let zLibVersion = unsafeBitCast(ret, verFunc.self) | |
print("\(String.fromCString(zLibVersion())!)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment