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

KO Myung-Hun komh78 at gmail.com
Mon Dec 8 03:58:18 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 | 19 ++++++++++++++++++-
 src/os2/thread.c      |  4 +++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 00435cb..d3f021b 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -391,7 +391,24 @@ struct vlc_cleanup_t
 #ifndef LIBVLC_USE_PTHREAD_CANCEL
 /* poll() with cancellation */
 # ifdef __OS2__
-int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout);
+static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
+{
+    static int (*vlc_poll_os2)(struct pollfd *, unsigned, int) = NULL;
+
+    if (!vlc_poll_os2)
+    {
+        HMODULE hmod;
+        CHAR szFailed[CCHMAXPATH];
+
+        if (DosLoadModule(szFailed, sizeof(szFailed), "vlccore", &hmod))
+            return -1;
+
+        if (DosQueryProcAddr(hmod, 0, "_vlc_poll_os2", (PFN *)&vlc_poll_os2))
+            return -1;
+    }
+
+    return (*vlc_poll_os2)(fds, nfds, timeout);
+}
 # else
 static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
 {
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 0ddcc47..1f3885c 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -696,7 +696,9 @@ static int vlc_select( int nfds, fd_set *rdset, fd_set *wrset, fd_set *exset,
 
 }
 
-int vlc_poll( struct pollfd *fds, unsigned nfds, int timeout )
+/* Export vlc_poll_os2 directly regardless of EXPORTS of .def */
+__declspec(dllexport)
+int vlc_poll_os2( struct pollfd *fds, unsigned nfds, int timeout )
 {
     fd_set rdset, wrset, exset;
 
-- 
1.8.5.2




More information about the vlc-devel mailing list