[vlc-devel] [PATCH 1/2] libacces_mms_plugins: fix linkage on OS/2

KO Myung-Hun komh78 at gmail.com
Sat Nov 22 10:11:50 CET 2014


-----
  CCLD     libaccess_mms_plugin.la
weakld: error: Unresolved symbol (UNDEF) '_vlc_poll'.
weakld: info: The symbol is referenced by:
    P:\tmp\ldconv_libaccess_mms_plugin_la-mmstu_38da54703f4316fd10.obj
Ignoring unresolved externals reported from weak prelinker.
Error! E2028: _vlc_poll is an undefined reference
file P:/tmp\ldconv_libaccess_mms_plugin_la-mmstu_38da54703f4316fd10.obj(ldconv_libaccess_mms_plugin_la-mmstu_38da54703f4316fd10.obj): undefined symbol _vlc_poll
-----
---
 include/vlc_threads.h | 27 ++------------------------
 src/Makefile.am       |  1 +
 src/extras/poll.c     | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/libvlccore.sym    |  1 +
 4 files changed, 57 insertions(+), 25 deletions(-)
 create mode 100644 src/extras/poll.c

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 00435cb..d84f1b9 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -388,33 +388,10 @@ struct vlc_cleanup_t
 
 #endif /* !LIBVLC_USE_PTHREAD_CLEANUP */
 
-#ifndef LIBVLC_USE_PTHREAD_CANCEL
 /* poll() with cancellation */
-# ifdef __OS2__
-int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout);
-# else
-static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
-{
-    int val;
-
-    do
-    {
-        int ugly_timeout = ((unsigned)timeout >= 50) ? 50 : timeout;
-        if (timeout >= 0)
-            timeout -= ugly_timeout;
-
-        vlc_testcancel ();
-        val = poll (fds, nfds, ugly_timeout);
-    }
-    while (val == 0 && timeout != 0);
-
-    return val;
-}
-# endif
-
-# define poll(u,n,t) vlc_poll(u, n, t)
+VLC_API int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout);
 
-#endif /* LIBVLC_USE_PTHREAD_CANCEL */
+#define poll(u,n,t) vlc_poll(u, n, t)
 
 static inline void vlc_cleanup_lock (void *lock)
 {
diff --git a/src/Makefile.am b/src/Makefile.am
index e200669..62fcd21 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -480,6 +480,7 @@ SOURCES_libvlc_common = \
 	misc/update_crypto.c \
 	misc/xml.c \
 	extras/libc.c \
+	extras/poll.c \
 	extras/tdestroy.c \
 	misc/addons.c \
 	misc/filter.c \
diff --git a/src/extras/poll.c b/src/extras/poll.c
new file mode 100644
index 0000000..9f62ca2
--- /dev/null
+++ b/src/extras/poll.c
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * poll.c: poll() replacement function for systems without cancelable poll()
+ *****************************************************************************
+ * Copyright (C) 2014 VLC authors and VideoLAN
+ *
+ * Authors: KO Myung-Hun <komh at chollian.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_threads.h>
+
+/* vlc_poll() for OS/2 is in src/os2/thread.c */
+#ifndef __OS2__
+int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
+{
+# ifndef LIBVLC_USE_PTHREAD_CANCEL
+    int val;
+
+    do
+    {
+        int ugly_timeout = ((unsigned)timeout >= 50) ? 50 : timeout;
+        if (timeout >= 0)
+            timeout -= ugly_timeout;
+
+        vlc_testcancel ();
+        val = (poll) (fds, nfds, ugly_timeout);
+    }
+    while (val == 0 && timeout != 0);
+
+    return val;
+# else
+    return (poll) (fds, nfds, timeout);
+# endif
+}
+#endif
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 10e036a..4efcf8b 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -650,3 +650,4 @@ addons_manager_Remove
 addon_entry_New
 addon_entry_Hold
 addon_entry_Release
+vlc_poll
-- 
1.8.5.2




More information about the vlc-devel mailing list