dlopen libncurses.so in wineconsole

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This patch doesn't include changes to configure. Run autoconf to regenerate it...


Mike


ChangeLog: * dlopen libncurses.so in wineconsole
? programs/wineconsole/curses.diff
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.170
diff -u -r1.170 configure.ac
--- configure.ac	11 Aug 2003 18:37:13 -0000	1.170
+++ configure.ac	12 Aug 2003 07:51:11 -0000
@@ -919,6 +919,7 @@
   WINE_GET_SONAME(jack,jack_client_new)
   WINE_GET_SONAME(ssl,SSL_library_init)
   WINE_GET_SONAME(crypto,BIO_new_socket)
+  WINE_GET_SONAME(ncurses,initscr)
 fi
 
 
Index: include/config.h.in
===================================================================
RCS file: /home/wine/wine/include/config.h.in,v
retrieving revision 1.157
diff -u -r1.157 config.h.in
--- include/config.h.in	20 Jun 2003 23:26:56 -0000	1.157
+++ include/config.h.in	12 Aug 2003 07:51:12 -0000
@@ -791,6 +791,9 @@
 /* Define to the soname of the libXrender library. */
 #undef SONAME_LIBXRENDER
 
+/* Define to the soname of the libncurses library. */
+#undef SONAME_LIBNCURSES
+
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at run-time.
Index: programs/wineconsole/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/wineconsole/Makefile.in,v
retrieving revision 1.7
diff -u -r1.7 Makefile.in
--- programs/wineconsole/Makefile.in	13 Dec 2002 23:37:06 -0000	1.7
+++ programs/wineconsole/Makefile.in	12 Aug 2003 07:51:12 -0000
@@ -4,7 +4,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = wineconsole.exe
-EXTRALIBS = @CURSESLIBS@
+EXTRALIBS = 
 APPMODE   = gui
 IMPORTS   = advapi32 kernel32 ntdll
 DELAYIMPORTS = comctl32 user32 gdi32
Index: programs/wineconsole/curses.c
===================================================================
RCS file: /home/wine/wine/programs/wineconsole/curses.c,v
retrieving revision 1.10
diff -u -r1.10 curses.c
--- programs/wineconsole/curses.c	14 Jun 2003 01:34:53 -0000	1.10
+++ programs/wineconsole/curses.c	12 Aug 2003 07:51:12 -0000
@@ -44,6 +44,8 @@
 #include <winnls.h>
 #include "winecon_private.h"
 
+#include "wine/library.h"
+#include "wine/port.h"
 #include "wine/server.h"
 #include "wine/debug.h"
 
@@ -63,6 +65,117 @@
 };
 
 
+static void *nc_handle = NULL;
+
+#define MAKE_FUNCPTR(f) typeof(f) * p_##f = NULL;
+
+MAKE_FUNCPTR(curs_set)
+MAKE_FUNCPTR(delwin)
+MAKE_FUNCPTR(endwin)
+MAKE_FUNCPTR(getmouse)
+MAKE_FUNCPTR(has_colors)
+MAKE_FUNCPTR(init_pair)
+MAKE_FUNCPTR(initscr)
+MAKE_FUNCPTR(intrflush)
+MAKE_FUNCPTR(keypad)
+MAKE_FUNCPTR(mouseinterval)
+MAKE_FUNCPTR(mousemask)
+MAKE_FUNCPTR(newpad)
+MAKE_FUNCPTR(nodelay)
+MAKE_FUNCPTR(noecho)
+MAKE_FUNCPTR(prefresh)
+MAKE_FUNCPTR(raw)
+MAKE_FUNCPTR(start_color)
+MAKE_FUNCPTR(stdscr)
+MAKE_FUNCPTR(waddchnstr)
+MAKE_FUNCPTR(wmove)
+MAKE_FUNCPTR(wgetch)
+
+#undef MAKE_FUNCPTR
+
+/**********************************************************************/
+
+typedef struct {
+    LPVOID lpCallback;
+    LPVOID lpContext;
+} DirectDrawEnumerateProcData;
+
+static BOOL WCCURSES_bind_libcurses()
+{
+    char *ncname = SONAME_LIBNCURSES;
+
+    nc_handle = wine_dlopen(ncname, RTLD_NOW, NULL, 0);
+    if(!nc_handle)
+    {
+        WINE_MESSAGE("Wine cannot find the ncurses library (%s).\n",ncname);
+	return FALSE;
+    }
+
+#define LOAD_FUNCPTR(f) \
+    if((p_##f = wine_dlsym(nc_handle, #f, NULL, 0)) == NULL) \
+    { \
+        WINE_WARN("Can't find symbol %s\n", #f); \
+        goto sym_not_found; \
+    }
+
+    LOAD_FUNCPTR(curs_set)
+    LOAD_FUNCPTR(delwin)
+    LOAD_FUNCPTR(endwin)
+    LOAD_FUNCPTR(getmouse)
+    LOAD_FUNCPTR(has_colors)
+    LOAD_FUNCPTR(init_pair)
+    LOAD_FUNCPTR(initscr)
+    LOAD_FUNCPTR(intrflush)
+    LOAD_FUNCPTR(keypad)
+    LOAD_FUNCPTR(mouseinterval)
+    LOAD_FUNCPTR(mousemask)
+    LOAD_FUNCPTR(newpad)
+    LOAD_FUNCPTR(nodelay)
+    LOAD_FUNCPTR(noecho)
+    LOAD_FUNCPTR(prefresh)
+    LOAD_FUNCPTR(raw)
+    LOAD_FUNCPTR(start_color)
+    LOAD_FUNCPTR(stdscr)
+    LOAD_FUNCPTR(waddchnstr)
+    LOAD_FUNCPTR(wmove)
+    LOAD_FUNCPTR(wgetch)
+
+#undef LOAD_FUNCPTR
+
+    return TRUE;
+
+sym_not_found:
+    WINE_MESSAGE(
+      "Wine cannot find certain functions that it needs inside the ncurses\n"
+      "library.  To enable Wine to use ncurses please upgrade your ncurses\n"
+      "libraries\n");
+    wine_dlclose(nc_handle, NULL, 0);
+    nc_handle = NULL;
+    return FALSE;
+}
+
+#define curs_set p_curs_set
+#define delwin p_delwin
+#define endwin p_endwin
+#define getmouse p_getmouse
+#define has_colors p_has_colors
+#define init_pair p_init_pair
+#define initscr p_initscr
+#define intrflush p_intrflush
+#define keypad p_keypad
+#define mouseinterval p_mouseinterval
+#define mousemask p_mousemask
+#define newpad p_newpad
+#define nodelay p_nodelay
+#define noecho p_noecho
+#define prefresh p_prefresh
+#define raw p_raw
+#define start_color p_start_color
+#define stdscr (*p_stdscr)
+#define waddchnstr p_waddchnstr
+#define wmove p_wmove
+#define wgetch p_wgetch
+
 /******************************************************************
  *		WCCURSES_ResizeScreenBuffer
  *
@@ -719,6 +832,9 @@
  */
 enum init_return WCCURSES_InitBackend(struct inner_data* data)
 {
+    if( !WCCURSES_bind_libcurses() )
+        return FALSE;
+
     data->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct inner_data_curse));
     if (!data->private) return init_failed;
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux