Frequently Asked Questions: CONCEPT

Q: My language 'XYZ' already has a binding with GTK! Why use the GTK-server?
A: If your language already has a binding with GTK, there is no reason to use the GTK-server. However, if your GTK binding is incomplete, or if your language has no binding with GTK at all, the GTK-server may be a clean alternative. The GTK-server primarily was designed with Shell scripts and console-based interpreters in mind. The idea is that you do not want to hack the sourcecode of an interpreter to achieve GUI programming. Languages like Python and Perl already have their own bindings to GTK, so there is no need to use the GTK-server in these cases. (The Python and Perl scripts at the examples page are there just to demonstrate the concept.)

Q: I want the GTK-server to work with Qt, FLTK, wxWidgets!
A: That is not possible, because these toolkits were implemented with C++. With a C++ shared object or DLL it is impossible to lookup a functionname, because the functionnames have been mangled to a unique name during compiletime. The reason for this is to make sure that overloaded functions will have a unique name. There is no way to know in advance how the name of a function is called. More details on this matter here. However, the GTK- and XForms toolkits were implemented with plain C, so the GTK-server concept works in these cases.

Q: Visual Basic scripting can do the same thing better!
A: Most likely. If you think so, please use VB script instead. However, you will be bound to BASIC, and therefore you'll not be able to use the advantages of languages like Prolog or Lisp.

Q: Can I use programming language 'XYZ' with the GTK-server?
A: In order to use the GTK-server, the client programming language has to fullfill only one requirement: be able to launch an external binary asynchronuously. This is already sufficient for the IPC interface!

Q: The language I want to use is not mentioned on this website!
A: Please take a look here to see if a binding exists for your programming language. Also you can contact me about it. Send your mail to 'peter AT gtk-server DOT org'.

Q: What is this 'embedded GTK'-concept you are talking about?
A: The 'embedded GTK'-concept is used in cases where the client language can use the names of the GTK functions directly, instead of wrapping them into one central communication function. This concept often can be realized by creating functions in the client language, which have the same name as GTK-functions. Each individual function acts as a wrapper, sending the GTK-function and arguments as a text string to the GTK-server, and returning the result to the caller. Check the BASH or the KornShell or the newLisp bindings to see how it works.

 

Frequently Asked Questions: COMPILATION

Q: How to compile this program on RedHat Advanced Server 4 or earlier?
A: Make sure all libraries are installed. Sometimes it is necessary to install the development libraries for GTK, GDK and PNG manually. For 64bit systems, it seems that the 64bit version of GTK resides in the '/usr/lib64/frysk' directory. To compile successfully, first set the PKG_CONFIG_PATH variable:

export PKG_CONFIG_PATH=/usr/lib64/frysk/pkgconfig

Sometimes it is necessary to specify GTK2 explicitly with the configure-script:

./configure --with-gtk2

Also verify your MAN page directory. On some RedHat systems, the MANPATH resides at '/usr/share/man' instead of the default '/usr/man'. In that case, run the configure-script as follows:

./configure --with-gtk2 --mandir=/usr/share/man

Q: Configure complains about 'missing header: ffi.h', but I have this file on my system!
A: The header file 'ffi.h' also includes 'ffitarget.h'. This header file probably resides at a different location. Try to find it with 'find / -name ffitarget.h' and export the environment variable CPPFLAGS to it's directory. On Zenwalk Linux for example, you need to do the following:

export CPPFLAGS=-I/usr/lib/gcc/i486-slackware-linux/3.4.6/include/libffi

Note the '-I' in front of the directoryname. Now run the 'configure'-script again.

Q: How about a static binary?
A: Only the Unix version can produce a self-containing binary which has all GTK functions included. This works only for GTK 1.x and XForms. Run the 'configure' script as follows:

./configure --enable-static

Then run 'make' to compile.

Q: How to compile for XForms?
A: The GTK-server can be compiled with XForms as backend, instead of GTK. Run the 'configure' script as follows:

./configure --with-xforms

Then run 'make' to compile. Support for Glade will be disabled when XForms is used as backend.

Q: How to compile the GTK-server for MacOSX?
A: Please read the instructions written by Leonardo Cecchi. EDIT: the GTK port for MacOSX is ready! Just install this port and compile GTK-server from the source.

Q: On which platforms the GTK-server has been compiled successfully?
A: The GTK-server should compile on Linux, Solaris, Tru64Unix, OpenBSD, NetBSD, FreeBSD, MacOSX, and Windows (by using MinGW).

 

Frequently Asked Questions: INSTALLATION

Q: When using the GTK 2 installer for Windows, I receive errors about fonts!
A: The font type 'MS Shell Dlg 8' is used by GTK 2. Apply the Windows Classic Theme to your desktop and the errors will disappear.

Q: I have installed GTK+ for Windows, but none of my programs work!
A: Make sure the GTK DLL's appear in your PATH environment variable. By default, the DLL's for GTK 2.x are installed in 'C:\Program Files\Common Files\GTK\2.0\bin'.

 

Frequently Asked Questions: USAGE

Q: Can I use other libraries than GTK?
A: Yes, this is possible. For example, check out the MikMod example here. Also libraries like libc, ncurses, OpenGL and GLUT can be used.

Q: I have tried some of your shellscripts but they do not start!
A: That is possible in case of Unix scripts connecting to the GTK-server using STDIN. You need to set the environmentvariables "LC_ALL" and "LD_LIBRARY_PATH". On my system for example, LC_ALL is set to "nl_NL" and LD_LIBRARY_PATH is set to "/usr/X11R6/lib".

Q: How to use GTK's typedef enumerations with your server?
A: Every enumeration has an internal C numbering. For example, the enumeration 'GtkWindowType' has two members: GTK_WINDOW_TOPLEVEL and GTK_WINDOW_POPUP. The first will be numbered with '0' and the second is numbered '1'. Now, if you want to use the GTK_WINDOW_TOPLEVEL enumeration just use the '0' in your script.
Since GTK-server 2.2.7 it is also possible to define enumerations in the configfile. Please read the manpage for more information.

Q: When I try to close a window, nothing happens!
A: With the new callback design, you have to connect the DELETE signal to the window, and catch this signal in your script. You can do this in your mainloop. After you have catched the signal, just exit GTK and the window will disappear.

Q: I want to use other GTK functions than mentioned in your configfile!
A: Please read the tutorial carefully, and consult the GTK site. They have excellent documentation and tutorials. You can extend the 'gtk-server.cfg' file yourself with the GTK functions you want to use!

Q: The GTK-server keeps crashing when I run my script!
A: Please make sure that you have the latest configfile for the gtk-server.

Q: Some SO/DLL says 'missing entry point for function'!
A: You try to run the gtk-server for GTK2 with the DLL's of GTK1 - or the other way around. Verify that the option 'LIB_NAME' is pointing to the correct GTK libraries.

Q: What communication interface with the GTK-server is preferred?
A: The best interfaces are the LIBRARY and the STDIN interface. The other interfaces consume more system resources and are slower.

Q: I want to create multiplatform programs with the GTK-server and I want to do it quick! Which language can I use?
A: The best choice is newLisp. It will give you full source compatibility on different platforms, rapid development, it is easy to learn and Open Source. Furthermore it supports all communication interfaces with the GTK-server.

Q: Why does the FIFO interface not work in Win9x/ME?
A: The Win9x/ME platforms cannot setup named pipes. This is a limitation in these operating systems, not in the GTK-server.