Created
January 4, 2017 17:55
-
-
Save laiso/1b6ddad01e5be1c79f0b94c0411c6f54 to your computer and use it in GitHub Desktop.
はー libmemcached の初期化処理が通らん…… #CodePiece
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 Foundation | |
import CLibmemcached | |
struct Memcached { | |
func connection() -> UnsafeMutablePointer<memcached_st> { | |
let memc1 = CLibmemcached.memcached_create(nil) | |
assert(memc1 != nil) // OK | |
let config = "--SERVER=localhost:11211" | |
var configPtr = [Int8](config.utf8CString) | |
let memc2 = CLibmemcached.memcached(&configPtr, configPtr.count) | |
assert(memc2 != nil) // nil | |
return memc2! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment