Implementing the GTK-server leads to the following considerations. • Accessing foreign functions is only possible when the accessed
libraries are created with a non
object oriented programming language like
C or
Pascal. Libraries created with
C++ for example, use
name mangling to unify
overloaded functions. This means that the functionname in a C++ library cannot be known once the shared library has been compiled. Hence the functions in such a library cannot be accessed. Therefore, libraries like
wxWidgets, the
Qt toolkit, Fast Light Toolkit (
FLTK) which are programmed in C++, cannot be accessed with the GTK-server concept. • The GTK library was implemented in the
programming language C. Since C is a
strongly typed programming language, the interpreted program needs to know the
data type of arguments and the type of the return value for each GTK function during
runtime. These can be defined on-the-fly or in a configuration file, which is parsed by the GTK-server during startup. However, the GTK-server does not know the functions which are going to be used by the interpreted client program, so for GTK-server all arguments and return values for each GTK function are variable types. This leads to a problem for the implementation, because the GTK functions and the corresponding arguments and return values cannot be hardcoded into the GTK-server binary. The way to resolve this is by using a
foreign function interface. Currently, four external foreign function interfaces are supported by GTK-server:
libffi, FFCALL, C/Invoke and dyncall. One of these libraries should be available on the target system, to compile the GTK-server successfully. ==Example==