func (object MQObject) Inq(goSelectors []int32, intAttrCount int, charAttrLen int) ([]int32,
	[]byte, error) {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqCharAttrs C.PMQCHAR
	var goCharAttrs []byte
	var goIntAttrs []int32
	var ptr C.PMQLONG
	if intAttrCount > 0 {
		goIntAttrs = make([]int32, intAttrCount)
		ptr = (C.PMQLONG)(unsafe.Pointer(&goIntAttrs[0]))
	} else {
		ptr = nil
	}
	if charAttrLen > 0 {
		mqCharAttrs = (C.PMQCHAR)(C.malloc(C.size_t(charAttrLen)))
		defer C.free(unsafe.Pointer(mqCharAttrs))
	} else {
		mqCharAttrs = nil
	}
	C.MQINQ(object.qMgr.hConn, object.hObj,
		C.MQLONG(len(goSelectors)),
		C.PMQLONG(unsafe.Pointer(&goSelectors[0])),
		C.MQLONG(intAttrCount),
		ptr,
		C.MQLONG(charAttrLen),
		mqCharAttrs,
		&mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQINQ",
	}
	if mqcc != C.MQCC_OK {
		return nil, nil, &mqreturn
	}
	if charAttrLen > 0 {
		goCharAttrs = C.GoBytes(unsafe.Pointer(mqCharAttrs), C.int(charAttrLen))
	}
	return goIntAttrs, goCharAttrs, nil
}
/*
Inq is the function to inquire on an attribute of an object

Slices are returned containing the integer attributes, and all the
strings concatenated into a single buffer - the caller needs to know
how long each field in that buffer will be.

The caller passes in how many integer selectors are expected to be
returned, as well as the maximum length of the char buffer to be returned
package ibmmq
import "C"
import (
	"encoding/binary"
	"unsafe"
)
type MQQueueManager struct {
	hConn C.MQHCONN
	Name  string
}
type MQObject struct {
	hObj C.MQHOBJ
	qMgr *MQQueueManager
	Name string
}
type MQReturn struct {
	MQCC int32
	MQRC int32
	verb string
}
func (e *MQReturn) Error() string {
	return mqstrerror(e.verb, C.MQLONG(e.MQCC), C.MQLONG(e.MQRC))
}
func setMQIString(a *C.char, v string, l int) {
	if len(v) > 0 {
		p := C.CString(v)
		C.strncpy(a, p, (C.size_t)(l))
		C.free(unsafe.Pointer(p))
	} else {
		*a = 0
	}
}
func Conn(goQMgrName string) (MQQueueManager, error) {
	return Connx(goQMgrName, nil)
}
func Connx(goQMgrName string, gocno *MQCNO) (MQQueueManager, error) {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqcno C.MQCNO
	if (C.MQENC_NATIVE % 2) == 0 {  
		endian = binary.LittleEndian
	} else {
		endian = binary.BigEndian
	}
	qMgr := MQQueueManager{}
	mqQMgrName := unsafe.Pointer(C.CString(goQMgrName))
	defer C.free(mqQMgrName)
	if gocno == nil {
		gocno = NewMQCNO()
		gocno.Options = MQCNO_HANDLE_SHARE_NO_BLOCK
	} else {
		if (gocno.Options & (MQCNO_HANDLE_SHARE_NO_BLOCK |
			MQCNO_HANDLE_SHARE_BLOCK)) == 0 {
			gocno.Options |= MQCNO_HANDLE_SHARE_NO_BLOCK
		}
	}
	copyCNOtoC(&mqcno, gocno)
	C.MQCONNX((*C.MQCHAR)(mqQMgrName), &mqcno, &qMgr.hConn, &mqcc, &mqrc)
	if gocno != nil {
		copyCNOfromC(&mqcno, gocno)
	}
	mqreturn := &MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQCONNX",
	}
	if mqcc != C.MQCC_OK {
		return qMgr, mqreturn
	}
	qMgr.Name = goQMgrName
	return qMgr, nil
}
func (x *MQQueueManager) Disc() error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	C.MQDISC(&x.hConn, &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQDISC",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (x *MQQueueManager) Open(good *MQOD, goOpenOptions int32) (MQObject, error) {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqod C.MQOD
	var mqOpenOptions C.MQLONG
	object := MQObject{
		Name: good.ObjectName,
		qMgr: x,
	}
	copyODtoC(&mqod, good)
	mqOpenOptions = C.MQLONG(goOpenOptions)
	C.MQOPEN(x.hConn,
		(C.PMQVOID)(unsafe.Pointer(&mqod)),
		mqOpenOptions,
		&object.hObj,
		&mqcc,
		&mqrc)
	copyODfromC(&mqod, good)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQOPEN",
	}
	if mqcc != C.MQCC_OK {
		return object, &mqreturn
	}
	object.Name = good.ObjectName
	return object, nil
}
func (object *MQObject) Close(goCloseOptions int32) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqCloseOptions C.MQLONG
	mqCloseOptions = C.MQLONG(goCloseOptions)
	C.MQCLOSE(object.qMgr.hConn, &object.hObj, mqCloseOptions, &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQCLOSE",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (x *MQQueueManager) Sub(gosd *MQSD, qObject *MQObject) (MQObject, error) {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqsd C.MQSD
	subObject := MQObject{
		Name: gosd.ObjectName,
		qMgr: x,
	}
	copySDtoC(&mqsd, gosd)
	C.MQSUB(x.hConn,
		(C.PMQVOID)(unsafe.Pointer(&mqsd)),
		&qObject.hObj,
		&subObject.hObj,
		&mqcc,
		&mqrc)
	copySDfromC(&mqsd, gosd)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQSUB",
	}
	if mqcc != C.MQCC_OK {
		return subObject, &mqreturn
	}
	qObject.qMgr = x  
	return subObject, nil
}
func (x *MQQueueManager) Cmit() error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	C.MQCMIT(x.hConn, &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQCMIT",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (x *MQQueueManager) Back() error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	C.MQBACK(x.hConn, &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQBACK",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (object MQObject) Put(gomd *MQMD,
	gopmo *MQPMO, buffer []byte) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqmd C.MQMD
	var mqpmo C.MQPMO
	var ptr C.PMQVOID
	bufflen := len(buffer)
	copyMDtoC(&mqmd, gomd)
	copyPMOtoC(&mqpmo, gopmo)
	if bufflen > 0 {
		ptr = (C.PMQVOID)(unsafe.Pointer(&buffer[0]))
	} else {
		ptr = nil
	}
	C.MQPUT(object.qMgr.hConn, object.hObj, (C.PMQVOID)(unsafe.Pointer(&mqmd)),
		(C.PMQVOID)(unsafe.Pointer(&mqpmo)),
		(C.MQLONG)(bufflen),
		ptr,
		&mqcc, &mqrc)
	copyMDfromC(&mqmd, gomd)
	copyPMOfromC(&mqpmo, gopmo)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQPUT",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (x *MQQueueManager) Put1(good *MQOD, gomd *MQMD,
	gopmo *MQPMO, buffer []byte) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqmd C.MQMD
	var mqpmo C.MQPMO
	var mqod C.MQOD
	var ptr C.PMQVOID
	copyODtoC(&mqod, good)
	copyMDtoC(&mqmd, gomd)
	copyPMOtoC(&mqpmo, gopmo)
	bufflen := len(buffer)
	if bufflen > 0 {
		ptr = (C.PMQVOID)(unsafe.Pointer(&buffer[0]))
	} else {
		ptr = nil
	}
	C.MQPUT1(x.hConn, (C.PMQVOID)(unsafe.Pointer(&mqod)),
		(C.PMQVOID)(unsafe.Pointer(&mqmd)),
		(C.PMQVOID)(unsafe.Pointer(&mqpmo)),
		(C.MQLONG)(bufflen),
		ptr,
		&mqcc, &mqrc)
	copyODfromC(&mqod, good)
	copyMDfromC(&mqmd, gomd)
	copyPMOfromC(&mqpmo, gopmo)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQPUT1",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (object MQObject) Get(gomd *MQMD,
	gogmo *MQGMO, buffer []byte) (int, error) {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqmd C.MQMD
	var mqgmo C.MQGMO
	var datalen C.MQLONG
	var ptr C.PMQVOID
	bufflen := len(buffer)
	copyMDtoC(&mqmd, gomd)
	copyGMOtoC(&mqgmo, gogmo)
	if bufflen > 0 {
		ptr = (C.PMQVOID)(unsafe.Pointer(&buffer[0]))
	} else {
		ptr = nil
	}
	C.MQGET(object.qMgr.hConn, object.hObj, (C.PMQVOID)(unsafe.Pointer(&mqmd)),
		(C.PMQVOID)(unsafe.Pointer(&mqgmo)),
		(C.MQLONG)(bufflen),
		ptr,
		&datalen,
		&mqcc, &mqrc)
	godatalen := int(datalen)
	copyMDfromC(&mqmd, gomd)
	copyGMOfromC(&mqgmo, gogmo)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQGET",
	}
	if mqcc != C.MQCC_OK {
		return 0, &mqreturn
	}
	return godatalen, nil
}