[zeromq-dev] pyzmq: using libzmq functions from cython

MinRK benjaminrk at gmail.com
Fri Aug 9 19:15:13 CEST 2013


Depending on the nature of your code, it should be okay as long as pyzmq is
imported first, which loads the bundled libzmq into RTLD_GLOBAL if there is
one.

It is meant to support use from Cython, but I confess that I am only aware
of one such project (gevent-zeromq), which has since been absorbed into
pyzmq itself as zmq.green (and it no longer uses Cython).

Can you perhaps share code where you are trying to do this?  Perhaps there
are things I should cleanup in pyzmq to make this easier.


On Fri, Aug 9, 2013 at 1:45 AM, Tom Farnbauer <tom.farnbauer at gmail.com>wrote:

> Hello,
>
> I have a somewhat peculiar problem. To get around the GIL, I have a small
> cython module that uses libzmq functions to set up some preliminary message
> processing before passing on messages to pure python code. The pure python
> code uses pyzmq as well. This obviously means that I need to use the zmq
> headers and libraries to compile and link the cython module, but at the
> same time I have to have pyzmq installed as well. All works fine as long as
> libzmq is available on LD_LIBRARY_PATH at runtime, but this is normally not
> the case when libzmq is bundled with pyzmq (since it sits in the directory
> of pyzmq).
>
> Does anyone have any advice on what would be the best solution to make the
> above thing work? Pyzmq seems to expose libzmq through the libzmq.pxd file,
> but I still need the libzmq headers and libraries to be able to build my
> python module. If, however, I link against a separate zmq prefix,
> libzmq.so.1 will be missing at runtime.
>
> Will I need to hook into the bundling process somehow to make sure that my
> extension module is built specifically against the bundled libzmq?
>
> The docs mention that pyzmq makes it simple to use its own extension
> modules, but also the core libzmq functions from cython (by having the
> modular pxd files I presume), but there is little detail in achieving that
> (unfortunately).
>
> Cheers,
>
> Tom
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130809/9de951e2/attachment.htm>


More information about the zeromq-dev mailing list