Skip to content

Instantly share code, notes, and snippets.

View jadengeller-asana's full-sized avatar

DEPRECATED_JadenGeller@Asana jadengeller-asana

View GitHub Profile
@neonichu
neonichu / DynamicFunctions.swift
Created October 7, 2014 21:50
Using dlopen / dlsym to call C functions from Swift
import Darwin
let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW)
let sym = dlsym(handle, "random")
let functionPointer = UnsafeMutablePointer<() -> CLong>(sym)
let result = functionPointer.memory()
println(result)