Source

pyzmq-static / patch-zmq-init

Full commit
--- zmq/__init__.py.orig	2011-04-01 18:54:36.000000000 -0400
+++ zmq/__init__.py	2011-04-01 18:54:40.000000000 -0400
@@ -23,6 +23,16 @@
 # Imports
 #-----------------------------------------------------------------------------
 
+# First, use ctypes to load the shared library.
+
+import ctypes
+import os
+p = os.path.join(os.path.dirname(__file__), "_zeromq.so")
+_zeromq = ctypes.CDLL(p, mode=ctypes.RTLD_GLOBAL)
+del ctypes, os, p
+
+# Now we can safely proceed to load the Python extensions.
+
 from zmq.utils import initthreads # initialize threads
 initthreads.init_threads()