********************************************************************* * * * LEDA * * * * Windows 95/98/NT/2000/XP * * MSVC++ 7.x * * Dynamic Link Libraries (DLL) * * * * Installation and Usage * * * ********************************************************************* This file describes the installation and usage of dynamic link libraries (DLLs) of LEDA with Microsoft Visual C++ .NET. Remark: This file describes the situation for the evaluation package of LEDA. 0. Contents of File ------------------- I. Preparations II. Files and Directories III. Compiling and Linking in Microsoft Visual C++ .NET IV. Compiling and Linking Application Programs in a DOS-Box V. Example programs and demos I. Preparations --------------- To install LEDA you only need to execute the LEDA distribution file LEDA---win32-.exe. During setup you can choose the name of the LEDA root directory and the parts of LEDA you want to install. Then you have to set the environment variable LEDAROOT as follows: 1. Windows NT/2000/XP: On these platforms LEDARROOT is set automatically to the directory where you installed LEDA by the setup program. 2. Windows 95/98: (a) Add the line set LEDAROOT= to the file "autoexec.bat" where is the root directory of your LEDA installation, e.g., D:\LEDA-5.0\ (b) Restart Windows 95/98 for the change to take effect. II. Files and Directories ------------------------- To compile and link your programs with LEDA, the LEDA main directory should contain the following files and subdirectories: Readme.txt Readme File Install\win32_msc7x_eval.txt this file incl\ the LEDA include directory license.txt License file and the following set of libraries - leda_mdd.dll, leda_mdd.lib, libGeoW_mdd_dll.lib Notice: A DLL version of Geowin is currently not available. III. Compiling and Linking in Microsoft Visual Studio.NET --------------------------------------------------------- (1) In the "File" menu of Visual C++ .NET click on "New->Project". (2) Choose "Visual C++ Projects" as project type and "Win32 Console Application" as template. Enter a project name, choose a directory for the project, and click "OK". (3) In the Win32 Application Wizard click on "Finish". If you already have a source file prog.cpp: (4) Activate the file browser and add prog.cpp to the main folder of your project. (5) In the Solution Explorer of your project click on "Source Files" with the right mouse button, then click on "Add->Add Existing Item" with the left mouse button. (6) Double click on prog.cpp If you want to enter a new source file: (4') In the Solution Explorer of your project click on "Source Files" with the right mouse button, then click on "Add-> Add New Item" with the left mouse button. (5') Choose "C++ File" in Templates, enter a name, and click "Open". (6') Enter your code. (7) In the Solution Explorer right click on your project and left click on "Properties" and make sure that the next changes, i.e. Steps (8)-(10), affect "All configurations". (8) Click on "C/C++" and "General". Choose "Additional include directories" and enter the directory \incl. (If you do not want to enter the directory manually you click on the grey rectangle on the right, this allows you to enter the directory in an interactive way.) (9) Click on "Linker" and "General". Choose "Additional library directories" and enter the directory . (If you do not want to enter the directory manually you click on the grey rectangle on the right, this allows you to enter the directory in an interactive way.) (10) (a) Click on "C/C++" and "Preprocessor" and add ";LEDA_DLL" in "Preprocessor Definitions". (b) Click on "Linker" and "Input", add the files libGeoW_mdd_dll.lib and leda_mdd.lib to "Additional Dependencies". NOTE: Alternatively you can add "#include " to stdafx.h. (This defines the macro LEDA_DLL and makes sure that the correct libraries are linked.) (11) Click on "C/C++" and "Code Generation" and choose the "Runtime Library" (=compiler flag) you want to use. In the evaluation package you either select "/MD" for the release configuration or "/MDd" for the debug configuration. (12) In the "Build" menu click on "Build " or "Rebuild " to compile your program. (13) To execute the program "prog.exe" Windows needs to have leda_mdd.dll in its search path for DLL's. Therefore, you need to do one of the following. Copy leda_mdd.dll to the bin\ subdirectory of your compiler or the directory containing "prog.exe". Alternatively, you can set the environment variable PATH to the directory containing leda_mdd.dll as described below. (14) In the "Build" menu click on "Execute prog.exe" to execute your program. Remark: If your C++ source code files has extension .c, you need to add the option "/TP" in "Project Options" (similar to Step (9)), otherwise you will get a number of compiler error. (Click on "C/C++" and "Command Line". Add /TP in "Additional Options" and click "Apply".) Examples of workspaces can be found in the directory \demo\msc_70_workspaces. To add LEDA to an existing Project in Microsoft Visual C++ .NET, start the Microsoft Visual Studio with your project and follow Steps (7)-(11) above. IV. Compiling and Linking Application Programs in a DOS-Box ---------------------------------------------------------- (a) Setting the Environment Variables for Visual C++ .NET: The compiler CL.EXE and the linker LINK.EXE require that the environment variables PATH, INCLUDE, and LIB have been set properly. When Visual C++ .NET was installed, setup created a batch file, VSVARS32.BAT, containing commands to modify PATH, LIB, and INCLUDE. Run VSVARS32.BAT at the command prompt before you compile your application program. VSVARS32.BAT is located in the \bin subdirectory of your compiler installation, e.g., c:\programs\microsoft visual studio .NET\Vc7\bin. To compile programs together with LEDA, the environment variables PATH, LIB, and INCLUDE must additionally contain the corresponding LEDA directories. (b) Setting Environment Variables for LEDA: (i) Windows NT/2000/XP: 1. In the "Start" menu, point to "Settings", then click "Control Panel". 2. In the "Control Panel", double click "System". 3. In the System Properties dialog box, click the Environment tab (for NT), respectively the Extended tab and then on "Environment Variables" (for 2000/XP). If a user variable PATH, LIB, or INCLUDE already exists, extend the current value as follows: extend PATH by extend INCLUDE by \incl extend LIB by Otherwise add new a user variable PATH, INCLUDE, or LIB with value , respectively \incl. (ii) Windows 95/98: 1. Change the file autoexec.bat as follows: If a variable PATH, INCLUDE, or LIB is already set, append the appropriate LEDA directory , respectively \incl. Otherwise add a corresponding line to autoexec.bat: set PATH= set INCLUDE= \incl set LIB= 2. Restart Windows 95/98 for the change to take effect. After these procedures, it suffices to call VSVARS32.BAT at the command prompt. In both cases the LEDA paths are automatically appended to the compiler paths. (c) Compiling and Linking Application Programs: After setting the environment variables, you can use the LEDA libraries as follows to compile and link programs. Programs that do not use GeoWin: cl