 public typealias ArgumentExtractor = (Int, UnsafeMutableRawPointer?) -> Void
 public typealias ReturnValueSetter = (UnsafeMutableRawPointer?) -> Void
 
+fileprivate func arg<T>(_ extractor: ArgumentExtractor, _ pos: Int) -> T {
+  let arg = UnsafeMutablePointer<T>.allocate(capacity: 1)
+  extractor(pos, arg)
+  return arg.pointee
+}
+
 public class ProtocolProxy: RKProtocolProxyBase {
 
   private var invokers: [Selector: (ArgumentExtractor, ReturnValueSetter?) -> Void] = [:]

  }

  private func registerInvoker<R>(for selector: Selector, block: @escaping () -> R) {
    invokers[selector] = { extractor, setReturnValue in
      var r = block()
      if let setReturnValue = setReturnValue { setReturnValue(&r) }
    }


  private func registerInvoker<T, U, V, W, R>(for selector: Selector, block: @escaping (T, U, V, W) -> R) {
    invokers[selector] = { extractor, setReturnValue in
      var r = block(arg(extractor, 2), arg(extractor, 3), arg(extractor, 4), arg(extractor, 5))
      if let setReturnValue = setReturnValue { setReturnValue(&r) }
    }
    registerDelegate()
