Skip to content

Commit

Permalink
Compatibility with Mac OS X: choose dynamic library extension by
Browse files Browse the repository at this point in the history
platform.
  • Loading branch information
Andrey Smirnov committed May 30, 2011
1 parent 5d3690e commit c8c8419
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zmq/_zmq.py
Expand Up @@ -25,6 +25,7 @@
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.


import random import random
import platform


# hack to avoid twisted tests failure # hack to avoid twisted tests failure
import py import py
Expand Down Expand Up @@ -93,7 +94,7 @@ def _check_zmq_errno(result, func, arguments):
raise ZMQError(errno) raise ZMQError(errno)
return result return result


libzmq = CDLL("libzmq.so", use_errno=True) libzmq = CDLL("libzmq" + (".dylib" if platform.system() == "Darwin" else ".so"), use_errno=True)


libzmq.zmq_version.restype = None libzmq.zmq_version.restype = None
libzmq.zmq_version.argtypes = [POINTER(c_int)]*3 libzmq.zmq_version.argtypes = [POINTER(c_int)]*3
Expand Down

4 comments on commit c8c8419

@dholth
Copy link

@dholth dholth commented on c8c8419 Jun 2, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe ctypes has a find library function that takes 'zmq' and prepends, appends lib, .dylib, .so as necessary.

@smira
Copy link
Collaborator

@smira smira commented on c8c8419 Jun 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dholth, it doesn't seem to work for me on Python 2.7 and Mac OS X:

E OSError: dlopen(zmq, 6): no suitable image found. Did find:
E zmq: not a file

@dholth
Copy link

@dholth dholth commented on c8c8419 Jun 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smira
Copy link
Collaborator

@smira smira commented on c8c8419 Jul 5, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in: 808c9ba

Please sign in to comment.