Hi, I have a compile problem using native “C” types.
My problem is that the cast from MqTypeE to enum MqTypeE ends up in an error.
BOTH types have the same size uint32
if I skip the MqTypeE definition and replace it with uint32 than it compiles without error
I expect that the cast between the same types does not create an error.
code:
func (this *MqBufferC) CastTo (typ MqTypeE) {
hdl := this.getHdl()
var errVal C.enum_MqErrorE = C.MqBufferCastTo (hdl, typ)
if (errVal == C.MQ_ERROR) { MqErrorEException((C.MQ_MNG)(hdl), errVal) }
}
error:
cannot use typ (type MqTypeE) as type uint32 in assignment
C.MqBufferCastTo:
MQ_EXTERN enum MqErrorE
MQ_DECL MqBufferCastTo (
MQ_BUF const buf,
enum MqTypeE const typ
) __attribute__((nonnull (1)));
MqTypeE in go:
type MqTypeE C.enum_MqTypeE
MqTypeE in C:
enum MqTypeE {
MQ_BYTT = (1<<4 | MQ_TYPE_IS_1_BYTE), ///< Y: 1 byte 'byte' type
MQ_BOLT = (2<<4 | MQ_TYPE_IS_1_BYTE), ///< O: 1 byte 'boolean' type
MQ_SRTT = (3<<4 | MQ_TYPE_IS_2_BYTE), ///< S: 2 byte 'short' type
MQ_INTT = (4<<4 | MQ_TYPE_IS_4_BYTE), ///< I: 4 byte 'int' type
MQ_FLTT = (5<<4 | MQ_TYPE_IS_4_BYTE), ///< F: 4 byte 'float' type
MQ_WIDT = (6<<4 | MQ_TYPE_IS_8_BYTE), ///< W: 8 byte 'long long int' type
MQ_DBLT = (7<<4 | MQ_TYPE_IS_8_BYTE), ///< D: 8 byte 'double' type
MQ_TRAT = (8<<4 | MQ_TYPE_IS_8_BYTE), ///< T: 8 byte 'transaction' type
MQ_BINT = (9<<4 ), ///< B: \e byte-array type
MQ_STRT = (10<<4 ), ///< C: \e string type (e.g. with a \\0 at the end)
MQ_LSTT = (11<<4 ), ///< L: list object type
};