示例#1
0
func NewConnector(clientName string) (*Connector, error) {
	x := new(Connector)
	cClientName := C.CString(clientName)
	defer C.free(unsafe.Pointer(cClientName))
	x.connection = C.xmmsc_init(cClientName)
	if x.connection == nil {
		return nil, fmt.Errorf("Client init failed")
	}
	return x, nil
}
示例#2
0
// Make new xmmsclient instance.
func NewXmms2Client(clientName string) (*Xmms2Client, error) {
	x := new(Xmms2Client)
	cClientName := C.CString(clientName)
	defer C.free(unsafe.Pointer(cClientName))
	x.connection = C.xmmsc_init(cClientName)
	x.returnValue = new(Value)
	if x.connection == nil {
		return nil, errors.New("Client init failed")
	}
	return x, nil
}