0032308: Configuration - make Xlib dependency optional
[occt.git] / src / Draw / Draw_Main.hxx
CommitLineData
b311480e 1// Created on: 1999-12-30
2// Created by: data exchange team
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17// Defines common framework for declaration of main/WinMain functions
54adc5e9 18// for executables on UNIX and WNT that extends DRAW Test Harness.
7fd59977 19
20// In order to create executable in DRAW environment, in the executable
21// the following line should be added:
22// DRAW_MAIN
23
24#ifndef Draw_Main_HeaderFile
25#define Draw_Main_HeaderFile
26
7fd59977 27#include <Standard_TypeDef.hxx>
7fd59977 28#include <Draw_Appli.hxx>
29#include <Standard_PCharacter.hxx>
30
31typedef void (*FDraw_InitAppli)(Draw_Interpretor&);
32
cf0786da 33Standard_EXPORT Standard_Integer Draw_Main (Standard_Integer argc, Standard_PCharacter argv[], const FDraw_InitAppli Draw_InitAppli);
34
35// Declarations of macros DRAW_MAIN to be used in executables instead of explicit main/WinMain
36#ifdef _WIN32
37
7fd59977 38#include <windows.h>
7fd59977 39
cf0786da 40Standard_EXPORT Standard_Integer Draw_WinMain (HINSTANCE hInstance,
41 HINSTANCE hPrevinstance,
42 LPSTR lpCmdLine,
43 Standard_Integer nCmdShow,
44 const FDraw_InitAppli Draw_InitAppli);
7fd59977 45
7fd59977 46// WinMain() and main()
cf0786da 47#define DRAW_MAIN Standard_Integer PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, Standard_Integer nCmdShow) \
48{ return Draw_WinMain (hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); } \
7fd59977 49\
cf0786da 50int main (int argc, char* argv[]) \
51{ return Draw_Main (argc, argv, Draw_InitAppli); }
52
53#else
7fd59977 54
cf0786da 55// main()
56#define DRAW_MAIN int main (Standard_Integer argc, char* argv[]) \
57{ return Draw_Main (argc, argv, Draw_InitAppli); }
58
59#endif
7fd59977 60
61#endif