code: func handleXpcEvent(event C.xpc_object_t, p C.ulong) {
  	//log.Printf("handleXpcEvent %#v %#v\n", event, p)
  
  	t := C.xpc_get_type(event)
  
  	eh := handlers[uintptr(p)]
  	if eh == nil {
  		//log.Println("no handler for", p)
  		return
  	}
  
  	if t == C.TYPE_ERROR {
  		if event == C.ERROR_CONNECTION_INVALID {
  			// The client process on the other end of the connection has either
  			// crashed or cancelled the connection. After receiving this error,
  			// the connection is in an invalid state, and you do not need to
  			// call xpc_connection_cancel(). Just tear down any associated state
  			// here.
  			//log.Println("connection invalid")
  			eh.HandleXpcEvent(nil, CONNECTION_INVALID)
  		} else if event == C.ERROR_CONNECTION_INTERRUPTED {
  			//log.Println("connection interrupted")
  			eh.HandleXpcEvent(nil, CONNECTION_INTERRUPTED)
  		} else if event == C.ERROR_CONNECTION_TERMINATED {
  			// Handle per-connection termination cleanup.
  			//log.Println("connection terminated")
  			eh.HandleXpcEvent(nil, CONNECTION_TERMINATED)
  		} else {
  			//log.Println("got some error", event)
  			eh.HandleXpcEvent(nil, fmt.Errorf("%v", event))
  		}
  	} else {
  		eh.HandleXpcEvent(xpcToGo(event).(Dict), nil)
  	}
  }
docs: //export handleXpcEvent