]> git.sesse.net Git - vlc/commitdiff
access_mms: fix linkage on OS/2
authorKO Myung-Hun <komh78@gmail.com>
Mon, 8 Dec 2014 02:58:18 +0000 (11:58 +0900)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 12 Dec 2014 15:00:53 +0000 (17:00 +0200)
-----
  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
-----

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
include/vlc_threads.h
src/os2/thread.c

index 00435cb68952591b4fb4938d271387ed5165426b..d3f021bb40b1a1bda32fa79aabc3066139f161f2 100644 (file)
@@ -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)
 {
index 0ddcc47dba8a25639a5126e503bb78d224d1f18c..1f3885ccf963568ab1213fdbf8ad3d3d8fddd690 100644 (file)
@@ -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;