It appears as though the cinterop tool has generat...
# kotlin-native
n
It appears as though the cinterop tool has generated incorrect mappings for the rabbitmq-c library ( https://github.com/alanxz/rabbitmq-c ). Trying to set the content_type field on a instance of amqp_basic_properties_t, based on the amqp_sendstring sample ( https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_sendstring.c#L89 ). However the content_type field is read only instead of being writable.
My sample amqp-client project can be found here: https://gitlab.com/napperley/amqp-client
k
File a ticket on youtrack.jetbrains.com?
s
IIUC,
content_type
field type is a struct. In this case it is supposed to be
val
. Typically this simplifies accessing the contents of the field. If you need to rewrite the entire aggregate field value, something like this should help:
Copy code
amqp_cstring_bytes("text/plain").place(props.content_type.ptr)
👍 1
n
Tried the copy value method:
Copy code
amqp_cstring_bytes("text/plain".cstr.ptr).place(props.content_type.ptr)
However the method doesn't work. The
content_type
field remains empty.
A no string conversion has to be applied to
amqp_cstring_bytes
in order to set the message body.
Discovered that the memory scope needs to be widened. The contentType C string ptr needs to be allocated in the publishMessage function, and passed through as a parameter to the setupAmqpProperties function, instead of allocating the C string ptr in the setupAmqpProperties function.