Guia

IUP - Portable User Interface

Guide

Building Applications

To compile programs in C, simply include file iup.h. If the application only uses functions from IUP and other portable languages such as C or Lua, with the same prototype for all platforms, then the application immediately becomes platform independent, at least concerning user interface, because the implementation of the IUP functions is different in each platform. The linker is in charge of solving the IUP functions using the library specified in the project/makefile. For further information on how to link your application, please refer to the specific driver documentation.

IUP can also work together with other interface toolkits. The main problem is the IupMainLoop function. If you are going to use only Popup dialogs, then it is very simple. But to use non modal dialogs without the IupMainLoop you must call IupLoopStep from inside your own message loop. Also it is not possible to use Iup controls with dialogs from other toolkits and vice-versa.

The generation of applications is highly dependent on each system, but at least the iup.lib/.a/.so library must be linked.

To use the Lua Binding, you need to link the program with the iuplua.lib/.a/.so library and with the lua.lib/.a/.so and lualib.lib/.a/.so  libraries. IupLua is available for Lua 3.2 and Lua 5.0.

The download files list includes the Tecgraf/PUC-Rio Library Download Tips document, with description of all the available binaries.

Windows

In Windows, you must link also with the libraries ole32.lib and comctl32.lib (provided with the compilers). The iup.rc resource file must be included in the application's project/makefile so that HAND, IUP, PEN and SPLITH cursors can be used.

There is also a guide on using the Dev-C++ IDE Project Options and Visual C++ IDE Project Properties.

Motif

In Motif, IUP uses the Motif (Xm), the Xtoolkit (Xt) and the Xlib (X11) libraries. To link an application to IUP, use the following options in the linker call (in the same order):

-liup -lXm -lXmu -lXt -lX11 -lm

Though these are the minimum requirements, depending on the platform other libraries might be needed. Typically, they are X extensions (Xext), needed in SunOS, and Xpm, needed in Linux. They must be listed after Xt and before X11. For instance:

-liup -lXm -lXmu -lXt -lXpm -lXext -lX11 -lm

Usually these libraries are placed in default directories, being automatically located by the linker. When the linker warns you about a missing library, add their location directories with option -L. In Tecgraf, some machines require such option:

Standard -L/usr/lib -I/usr/include
Linux -L/usr/X11R6/lib -I/usr/X11R6/include
IRIX -L/usr/lib32 -I/usr/include/X11
Solaris -L/usr/openwin/lib -I/usr/openwin/share/include/X11
AIX -I/usr/include/Motif2.1

Following are some makefile suggestions. All of them can be used in SunOS (Sun), IRIX (Silicon) and AIX (IBM) systems. For Linux, -lXpm must be added at the end of the SYSLIBS variable.

Building The Library

The easiest way to build the library is to install the Tecmake tool into your system. It is easy and helps a lot. The Tecmake configuration files (*.mak) available at the "src" folder are very easy to understand also.

Tecmake is a command line multi compiler build tool available at http://www.tecgraf.puc-rio.br/tecmake. Tecmake is used by all the Tecgraf libraries and many applications.

But we also provide a stand alone makefile for Linux systems and a Visual Studio workspace with the respective projects. The stand alone makefile is created using Premake and a configuration file in lua called "premake.lua".

IUP runs on many different systems and interact with many different libraries such as Motif, OpenGL, Canvas Draw (CD) and Lua (3 and 5). You have to install some these libraries to use the IUP libraries. IUP standalone only depends on the Windows core libraries (alreay installed in the system) and on the Motif 2.x+X11-R6. In Linux you should use Open Motif 2.x. If you only have Motif 1.2 some features will be limited and you must add the file "src/mot/ComboBox1.c".

Tecmake Tips

From the Tecmake manual:

"Tecmake is essentially a general GNU makefile with a series of predefined targets and rules with the purpose of providing those in charge of developing libraries and applications the necessary tools so that versions for different platforms can be generated homogeneously. In other words, the tecmake user does not need to create a makefile nor be concerned with his/her current platform to create a library or application, which we will here call product."

Note that Tecmake defines names for each system. For example: vc7 (Visual Studio 7) or Linux24g3 (Linux Kernel 2.4 with gcc 3.x.)

When installing Tecmake you will need to set a few environment variables.You should refer to Tecmake's manual, but here are a few tips on how to install it (tested on Redhat 7.0):

  • Set environment variables TCG_HOME and TECMAKE_HOME pointing to where tecmake.mak is installed;
  • Set variables TEC_UNAME, TEC_SYSNAME, TEC_SYSRELEASE. These are well explained in Tecmake's manual under Platforms.

In IUP's main directory there is a file named make_uname (make_uname.bat in Windows) that calls Tecmake for each IUP library. To build IUP for Windows using Visual C 7.0 for example, just execute make_uname.bat vc7