词条 | GTK-server |
释义 |
|name = GTK-server |logo = |released = 2003 |author = Peter van Eerten |developer = Peter van Eerten |latest_release_version = 2.4.1 |latest_release_date = January 1, 2017 |operating_system = Cross-platform |license = GNU General Public License |website = www.gtk-server.org }} GTK-server is an open-source project released under the GNU General Public License. The GTK-server project aims to bring Graphical User Interface programming to any interpreted language using the GIMP Tool Kit (GTK) or XForms. PhilosophyThe GTK-server provides a stream-oriented interface to GTK. If the GTK-server is compiled as a standalone binary, it allows five different interfaces: stdin, fifo (named pipe), ipc (message queue), tcp or udp. Any interpreted language or shellscript with I/O capabilities can start the GTK-server with an argument specifying the type of interface, and can start sending GTK function calls in S-Expression format. After each request, the GTK-server returns a result, depending on the type of GTK function invoked. If the GTK-server is compiled as a shared object, it exports the function 'gtk', which must be imported in the client program first. After that, the client program can start sending GTK function calls in S-Expression format as argument to the imported 'gtk' function. Before the GTK-server actually can execute GTK functions, it has to read a configuration file in which the prototypes of the GTK functions are described. Since version 2.2.3 this also can be done on-the-fly, allowing the GTK-server to run without configuration file. ImplementationImplementing the GTK-server leads to the following considerations.
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, in order to compile the GTK-server successfully. ExampleThe following Kornshell script starts the GTK-server in stdin mode, and creates a simple window with an exit button: Advantages and limitationsAlthough GTK was meant to be used with the C programming language, it is now possible to use GTK from any interpreted language without changing the actual implementation of the interpreter. Also, GTK 1.x, GTK2.x and GTK 3.x can be reached. Optionally, any other shared library can be used, like OpenGL related libraries, Poppler, Mozilla, but also libc, sqlite and a music library like MikMod. When using the GTK-server as a standalone binary, it inevitably creates an additional process in the processlist. Also, GTK functions defined as a macro cannot be reached by a client program. 3 : GTK|Application programming interfaces|X-based libraries |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。