func (object MQObject) Get(gomd *MQMD,
	gogmo *MQGMO, buffer []byte) (int, error) {
	return object.getInternal(gomd, gogmo, buffer, false)
}
/*
Get a message from a queue
The length of the retrieved message is returned.
package ibmmq
import "C"
import (
	"encoding/binary"
	_ "fmt"
	"io"
	"os"
	"strings"
	"time"
	"unsafe"
)
type MQQueueManager struct {
	hConn C.MQHCONN
	Name  string
}
type MQObject struct {
	hObj C.MQHOBJ
	qMgr *MQQueueManager
	Name string
}
type MQMessageHandle struct {
	hMsg C.MQHMSG
	qMgr *MQQueueManager
}
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))
}
var endian binary.ByteOrder  
const space8 = "        "
const (
	mqDateTimeFormat = "20060102150405.00 MST"  
	mqDateFormat     = "20060102"
	mqTimeFormat     = "150405.00"
)
func init() {
	if C.MQENC_NATIVE%2 == 0 {
		endian = binary.LittleEndian
	} else {
		endian = binary.BigEndian
	}
}
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 trimStringN(c *C.char, l C.int) string {
	var rc string
	s := C.GoStringN(c, l)
	i := strings.IndexByte(s, 0)
	if i == -1 {
		rc = s
	} else {
		rc = s[0:i]
	}
	return strings.TrimSpace(rc)
}
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
	os.Setenv("MQS_NO_SYNC_SIGNAL_HANDLING", "true")
	qMgr := MQQueueManager{}
	qMgr.Name = goQMgrName
	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
	}
	return qMgr, nil
}
func (x *MQQueueManager) Disc() error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	savedConn := x.hConn
	C.MQDISC(&x.hConn, &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQDISC",
	}
	if int32(mqrc) != C.MQRC_HCONN_ERROR {
		cbRemoveConnection(savedConn)
	}
	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.MQOO_FAIL_IF_QUIESCING
	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
	if good.ObjectType == C.MQOT_TOPIC {
		object.Name = good.ObjectString
	}
	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)
	savedHConn := object.qMgr.hConn
	savedHObj := object.hObj
	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
	}
	cbRemoveHandle(savedHConn, savedHObj)
	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 + "[" + gosd.ObjectString + "]",
		qMgr: x,
	}
	err := checkSD(gosd, "MQSUB")
	if err != nil {
		return subObject, err
	}
	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 (subObject *MQObject) Subrq(gosro *MQSRO, action int32) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqsro C.MQSRO
	copySROtoC(&mqsro, gosro)
	C.MQSUBRQ(subObject.qMgr.hConn,
		subObject.hObj,
		C.MQLONG(action),
		(C.PMQVOID)(unsafe.Pointer(&mqsro)),
		&mqcc,
		&mqrc)
	copySROfromC(&mqsro, gosro)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQSUBRQ",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return nil
}
func (x *MQQueueManager) Begin(gobo *MQBO) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqbo C.MQBO
	copyBOtoC(&mqbo, gobo)
	C.MQBEGIN(x.hConn, (C.PMQVOID)(unsafe.Pointer(&mqbo)), &mqcc, &mqrc)
	copyBOfromC(&mqbo, gobo)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQBEGIN",
	}
	if mqcc != C.MQCC_OK {
		return &mqreturn
	}
	return 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 (x *MQQueueManager) Stat(statusType int32, gosts *MQSTS) error {
	var mqrc C.MQLONG
	var mqcc C.MQLONG
	var mqsts C.MQSTS
	copySTStoC(&mqsts, gosts)
	C.MQSTAT(x.hConn, C.MQLONG(statusType), (C.PMQVOID)(unsafe.Pointer(&mqsts)), &mqcc, &mqrc)
	mqreturn := MQReturn{MQCC: int32(mqcc),
		MQRC: int32(mqrc),
		verb: "MQSTAT",
	}
	copySTSfromC(&mqsts, gosts)
	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
	err := checkMD(gomd, "MQPUT")
	if err != nil {
		return err
	}
	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
	err := checkMD(gomd, "MQPUT1")
	if err != nil {
		return err
	}
	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
}