2012-07-17 Yaakov Selkowitz * faq-programming.xml (faq.programming.unix-gui): Update to reflect the availability of X11 toolkits on Cygwin. Index: faq-programming.xml =================================================================== RCS file: /cvs/src/src/winsup/doc/faq-programming.xml,v retrieving revision 1.19 diff -u -p -r1.19 faq-programming.xml --- faq-programming.xml 23 Apr 2012 21:46:46 -0000 1.19 +++ faq-programming.xml 18 Jul 2012 00:29:30 -0000 @@ -810,20 +810,42 @@ a Windows environment which Cygwin handl How should I port my Unix GUI to Windows? -There are two basic strategies for porting Unix GUIs to Windows. - -The first is to use a portable graphics library such as tcl/tk, X11, or -V (and others?). Typically, you will end up with a GUI on Windows that -requires some runtime support. With tcl/tk, you'll want to include the -necessary library files and the tcl/tk DLLs. In the case of X11, you'll -need everyone using your program to have the X11 server installed. - -The second method is to rewrite your GUI using Win32 API calls (or MFC -with VC++). If your program is written in a fairly modular fashion, you -may still want to use Cygwin if your program contains a lot of shared -(non-GUI-related) code. That way you still gain some of the portability -advantages inherent in using Cygwin. - +Like other Unix-like platforms, the Cygwin distribtion includes many of +the common GUI toolkits, including X11, X Athena widgets, Motif, Tk, GTK+, +and Qt. Many programs which rely on these toolkits will work with little, if +any, porting work if they are otherwise portable. However, there are a few +things to look out for: + +Some packages written for both Windows and X11 incorrectly +treat Cygwin as a Windows platform rather than a Unix variant. Mixing Cygwin's +Unix APIs with Windows' GDI is best avoided; rather, remove these assumptions +so that Cygwin is treated like other X11 platforms. +GTK+ programs which use gtk_builder_connect_signals() +or glade_xml_signal_autoconnect() need to be able to +dlopen() themselves. In order for this to work, the program +must be linked with the -Wl,--export-all-symbols linker flag. +This can be added to LDFLAGS manually, or handled automatically with the +-export-dynamic libtool flag (requires libtool 2.2.8) or +by adding gmodule-export-2.0 to the pkg-config modules used +to build the package. +Programs which include their own loadable modules (plugins) +often must have its modules linked against the symbols in the program. The +most portable solution is for such programs to provide all its symbols (except +for main()) in a shared library, against which the plugins +can be linked. +If the package uses the CMake build system, this can be done by adding +ENABLE_EXPORTS TRUE to the program's set_target_properties +command, then adding the program's target name to the target_link_libraries +command for the plugins. +For other build systems, the following steps are required: + +The program must be built before its plugins. +Symbols must be exported from the program with a +-Wl,--export-all-symbols,--out-implib,libfoo.exe.a +linker flag. +The plugins must be linked with a -Wl,/path/to/libfoo.exe.a +linker flag. +