[vlc-commits] python bindings: fix libvlc_free emulation

Olivier Aubert git at videolan.org
Fri Apr 29 11:21:55 CEST 2011


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Fri Apr 29 11:20:33 2011 +0200| [c4914c4d9b584b60e8d07e384d17bf6c3b7ec127] | committer: Olivier Aubert

python bindings: fix libvlc_free emulation

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=c4914c4d9b584b60e8d07e384d17bf6c3b7ec127
---

 footer.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/footer.py b/footer.py
index 2dd903e..9315350 100644
--- a/footer.py
+++ b/footer.py
@@ -11,11 +11,16 @@ def callbackmethod(callback):
 if not hasattr(dll, 'libvlc_free'):
     # need to find the free function in the C runtime. This is
     # platform specific.
-    if sys.platform.startswith('linux'):
-        libc = ctypes.CDLL(find_library('c'))
-        libvlc_free = libc.free
+    # For Linux and MacOSX
+    libc_path = find_library('c')
+    if libc_path:
+        libc = ctypes.CDLL(libc_path)
+        libvlc_free = libc.free        
     else:
-        raise NotImplementedError('%s: %s without libvlc_free not supported' % (sys.argv[0], sys.platform))
+        # On win32, it is impossible to guess the proper lib to call
+        # (msvcrt, mingw...). Just raise an exception.
+        def libvlc_free(p):
+            raise NotImplementedError('%s: %s without libvlc_free not supported' % (sys.argv[0], sys.platform))
 
     # ensure argtypes is right, because default type of int won't work
     # on 64-bit systems



More information about the vlc-commits mailing list