Views User Guides > Foundation > Using Views on Microsoft Windows > Creating a New Views Application on Microsoft Windows
Creating a New Views Application on Microsoft Windows
To create a new Views application that does not contain any Windows code, all you have to do is create the main function and instantiate the IlvDisplay class by providing the application name to its constructor:
int
main(int argc, char* argv[])
{
IlvDisplay* display = new IlvDisplay("Views", "", argc, argv);
...
}
Note that ‘main’ is not the regular entry point of an application running on Microsoft Windows (it should be ‘WinMain’). Because of the source code portability that Views provides, and for easier command line parameter parsing, we choose to use the regular C++ ‘main’ entry point. The impact of this choice is discussed further in this topic.
The application name is used for resource scanning (see the section Display System Resourcespage 123). The second argument is not used on Microsoft Windows, and therefore it is replaced by an empty string. (It is used on X Window where it corresponds to an X display.) The last two parameters are also not used on Microsoft Windows.
Then you can build your view structure and objects and call the global function IlvMainLoop.
int
main(int argc, char* argv[])
{
IlvDisplay* display = new IlvDisplay("Views", "", argc, argv);
...
...
IlvMainLoop();
return 0;
}
Here, since a main function is provided instead of the WinMain entry point that Microsoft Windows expects to start an application, you have to link your object files with the ILVMAIN.OBJ file. This file, supplied with Views, defines a default WinMain function that does all the necessary initialization operations and calls the main function.
Note: To avoid conflicts with other definitions of the main function, which might be provided by some compilers, a preprocessor macro redefines the main function as IlvMain. This macro is declared in the header file <ilviews/ilv.h>.
For examples, look at the make or project files in the BIN directory.
Published date: 05/24/2022
Last modified date: 02/24/2022