***************************************************************************** * * * AGD and LEDA Windows NT/95/98/2000 * * * * MSVC++ 5.0/6.0 * * * * DLL's * * * ***************************************************************************** Remark: Starting with AGD version 1.2, the commercial version of AGD is integrated in a LEDA package. The following procedures therefore are an extension of the installation procedure for LEDA. I. Directory Overview --------------------- In this file I use to denote the path name of the AGD and LEDA main directory. It should contain the following files and subdirectories: AGD\Install\win32_lib.txt install and use static libs of AGD AGD\Install\win32_dll.txt this file Install\win32_lib.txt install and use static libs of LEDA Install\win32_dll.txt install and use DLLs of LEDA incl\ the include directory and at least one of the following dll/library sets - libagd_ml.lib, leda_ml.dll, leda_ml.lib - libagd_mld.lib, leda_mld.dll, leda_mld.lib - libagd_md.lib, leda_md.dll, leda_md.lib - libagd_mdd.lib, leda_mdd.dll, leda_mdd.lib - libagd_mt.lib, leda_mt.dll, leda_mt.lib - libagd_mtd.lib, leda_mtd.dll, leda_mtd.lib Note: There is currently no DLL of AGD available. II. Compiling and Linking Application Programs in Microsoft Visual Studio ------------------------------------------------------------------------- To compile and link an application program using AGD and LEDA in Microsoft Visual Studio proceed as follows: 1) In the "File" menu of Visual Studio click on "New" 2) Choose "Win 32 Console Application" in "Projects", fill in the project name, and click "OK" 3) Choose "Empty Project" and click "Finish" 4) After clicking "OK" you have an empty project space If you already have a source file "prog.cpp": 5) Activate the file browser and add "prog.cpp" to the main folder of your project 6) In the "Workspace" of Visual Studio click on "Source Files" with the right mouse button, then click on "Add File to Folder" with the left mouse button 7) Double click on "prog.cpp" If you want to enter a new source file: 5') In the "File" menu click on "New" 6') Choose "C++ Source File" in "Files", fill in the file name, and click "OK" 7') Enter your code 8) In the "Project" menu click on "Settings" 9) Choose "C/C++": - Enter in "Project Options" the compiler flag you want to use. The default value is "/MLd", alternatives are "/ML", "/MD", "/MDd", "/MT", and "/MTd". Notice that you have to use the AGD and LEDA libraries that correspond to the chosen flag, e.g., with option "/MD" you must use libAGD_md.lib, leda_md.lib, and leda_md.dll Using another pair of dll/library with "/MD" will lead to serious linker errors. - Add in "Preprocessor definitions" the compiler flag "LEDA_DLL". 10) Choose "Linker" and add the name of the AGD and LEDA library you want to use at the beginning of line "Object-/Library-Modules". I use to indicate the compiler option chosen in Step 9) (,i.e., is mld for "/MLd", ml for "/ML", ...). - "libAGD_.lib leda_.lib" 11) Click "OK" to leave the "Settings" 12) In the "Extras" menu click on "Options" 13) Choose "Directories" 14) Choose "Include Files" in "Show Directories for:" and add the directory "\incl" containing the AGD and LEDA include files (Double click on the small rectangle in "Directories", enter \incl, or click on the small grey rectangle on the right and choose the correct directory.) 15) Choose "Library Files" in "Show Directories for:" and add the directory "" containing the AGD and LEDA libraries. 16) Click "OK" to leave the "Options" 17) In the "Build" menu click on "Build prog.exe" or "Rebuild All" to compile your program. 18) To execute "prog.exe" the system needs to have "leda_.dll" in its search path for DLL's. Therefore you need to do one the following: - Copy "leda_.dll" to the subdirectory \bin of the compiler or the directory containing "prog.exe" - Alternatively you can set the environment variable PATH to the directory containing "leda_.dll" as described in IV, c) below. 19) 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" (Step 9)), otherwise you will get a number of compiler error. Examples of workspaces can be found in the directory /demo/msc_workspaces. III. Adding AGD and LEDA to a Project in Microsoft Visual Studio ---------------------------------------------------------------- To link the AGD and LEDA libraries to an already existing project proceed as follows: 1) Start the Microsoft Visual Studio with your project 2) In the "Project" menu click on "Settings" 3) Choose "C/C++" - Check in "Project Options" the compiler flag you use for your project. The default value is "/MLd", alternatives are "/ML", "/MD", "/MDd", "/MT", and "/MTd". Notice that you have to use the AGD and LEDA libraries that correspond to the chosen flag, e.g., with option "/MD" you must use libAGD_md.lib, leda_md.lib, and leda_md.dll. Using another pair with "/MD" will lead to serious linker errors. - Add in "Preprocessor definitions" the compiler flag "LEDA_DLL". 4) Choose "Linker" and add the name of the AGD and LEDA library you want to use at the beginning of line "Object-/Library-Modules". I use to indicate the compiler option chosen in Step 3) (,i.e., is mld for "/MLd", ml for "/ML", ...). - "libAGD_.lib leda_.lib" 4) Click "OK" to leave the "Settings" 5) In the "Extras" menu click on "Options" 6) Choose "Directories" 7) Choose "Include Files" in "Show Directories for:" and add the directory "\incl" containing the AGD and LEDA include files (Double click on the small rectangle in "Directories", enter \incl, or click on the small grey rectangle on the right and choose the correct directory.) 8) Choose "Library Files" in "Show Directories for:" and add the directory "" containing the AGD and LEDA libraries. 9) Click "OK" to leave the "Options" 10) You can now use the data types provided by AGD and LEDA in your project as described in the AGD and LEDA user manual. IV. Compiling and Linking Application Programs in a DOS-Box ------------------------------------------------------------ a) Setting the Environment Variables for Visual C++: The compiler CL.EXE and the linker LINK.EXE, require that the environment variables PATH, INCLUDE, and LIB have been set properly. PATH must point to the \bin subdirectory of your Visual C++ installation, LIB must point to \lib, and INCLUDE to \include. When you installed Visual C++, setup created a batch file, VCVARS32.BAT, containing commands to modify the PATH, LIB, and INCLUDE environment variables. Run VCVARS32.BAT before you compile at the command prompt. VCVARS32.BAT is located in the \bin subdirectory. Note that you do not need to run VCVARS32.BAT if you are compiling your program inside the development environment (see above). To run VCVARS32.BAT: - At the command prompt, change to the \bin subdirectory of your Visual C++ installation (for instance, c:\programs\microsoft developer studio\vc98\bin ). - Run VCVARS32.BAT by typing VCVARS32. To compile programs together with the AGD and LEDA libraries, the environment variables PATH, LIB, and INCLUDE must additionally contain the corresponding AGD and LEDA directories. There are two possibilities to modify the environment variables. The first can be used to change the variables for a single DOS-box, the second to modify the variables permanently. b) Setting Environment Variables for AGD and LEDA in a single DOS-Box: The AGD and LEDA main directory contains the batch file SET_LEDA_PATHS.BAT This file can be used to change the environment variables as follows - At the command prompt run VCVARS32.BAT as described above. - Change to the AGD and LEDA main directory - Run SET_LEDA_PATHS.BAT by typing SET_LEDA_PATHS (,e.g., if you have AGD and LEDA in d:\LEDA-4.3, you type SET_LEDA_PATHS d:\leda-4.3) c) Setting Environment Variables for AGD and LEDA permanently: i) Windows NT/2000: 1. On 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, and specify your environment variable setting for PATH, INCLUDE, and LIB, using the User Variables for, Variable, and Value boxes. If such a user variable already exists, click it in the User Variables for list. The name will then appear in the "Variable" field and its value in the "Value" field. Extend the current value by appending the appropriate AGD and LEDA directory separated by ";" from the existing values as follows: - extend PATH by - extend INCLUDE by \incl - extend LIB by In case a user variable does not exist, enter its name in the "Variable" field and the value in the "Value" field. - set PATH to - set INCLUDE to \incl - set LIB to ii) Windows 95/98: 1. Change the file "autoexec.bat" as follows: If the variables PATH, INCLUDE, or LIB are already set in "autoexec.bat", append the appropriate AGD and LEDA directory separated by ";" from the existing values as follows: - extend PATH by - extend INCLUDE by \incl - extend LIB by set INCLUDE=\incl set LIB= 2. Restart Windows 95 for the change to take effect. After these procedures, it suffices to call VCVARS32.BAT at the command prompt. In both cases the AGD and LEDA paths are automatically appended to the compiler paths. d) Compiling and Linking Programs: After setting the environment variables, you can use the library as follows to compile and link programs: cl -DLEDA_DLL -Tp prog.c where , , and are related as follows: -ML libAGD_ml.lib leda_ml.lib -MLd libAGD_mld.lib leda_mld.lib -MD libAGD_md.lib leda_md.lib -MDd libAGD_mdd.lib leda_mdd.lib -MT libAGD_mt.lib leda_mt.lib -MTd libAGD_mtd.lib leda_mtd.lib Remark: The option -Tp is necessary if the C++ source code files have extension .c, if your files have extension .cpp this option is not necessary. 4. Using Static Libraries instead of DLLs: ------------------------------------------ Information on how to use static libraries instead of Dll's can be found in win32_lib.txt.