#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)
{
}
-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;