[rabbitmq-discuss] rabbitmq-c

Scott Brooks scott.brooks at epicadvertising.com
Fri Sep 25 17:51:16 BST 2009

We have been using rabbitmq-c for quite a while internally, and it's  
been working great for us.

I have built a ruby wrapper for rabbitmq-c using ruby-ffi which i  
think we are planning on releasing soon, the only issue is that there  
are some API decisions that make rabbitmq-c hard to use with FFI.

Although passing the amqp_bytes_t as a struct is a really great  
solution to C strings, passing structs by value, and returning structs  
is not supported by libffi/ruby-ffi(as far as I could test anyways).

So I took amqp_api.c, and wrote amqp_api_p.c which accepts pointers to  
structs rather then copy by value.  These functions just create take  
the pointers, copy to local vars and then calls the existing functions.

In general I see a few solutions to the problem of wrapping rabbitmq-c  
for use in higher level languages.
A: don't support it
B: keep a parallel set of pass by pointer functions so either API can  
be used(currently it just copies the data passed to the pointer, and  
then calls the pass by value functions)
C: change the whole API to pass pointers.
D: some other solution

Any thoughts as to which direction you would like to take

Scott Brooks

More information about the rabbitmq-discuss mailing list