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 two requirements: 1) be able to launch an external binary asynchronuously, and 2) be able to communicate with a 2-way pipe, or a file (named pipe), or with TCP/IP or UDP/IP.

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: I receive complaints 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 create a symlink in your '/usr/include'-directory. On Zenwalk Linux for example, you need to do the following (as user 'root'):

ln -s /usr/lib/gcc/i486-slackware-linux/3.4.6/include/libffi/ffitarget.h /usr/include/ffitarget.h

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. 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.

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: 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.

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 my 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.