Next: Static Libraries for MS
Up: Technical Information
Previous: Static Libraries for MS
Contents
Index
Subsections
This section describes the installation and usage of
LEDA Dynamic Link Libraries (DLL's) with Microsoft Visual Studio 6.
Remark: This section describes the situation in a GUI package of LEDA.
If you have the geometry, graph, or basic package only the corresponding
libraries are provided.
To install LEDA you only need to execute the LEDA distribution
file LEDA-<ver>-<package>-win32-<compiler>.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:
- Windows NT/2000/XP: On these platforms LEDARROOT is
set automatically to the directory where you installed LEDA by the setup
program.
- Windows 95/98:
- Add the line
set LEDAROOT=<LEDA>
to the file "autoexec.bat" where <LEDA> is the root directory
of your LEDA installation, e.g.,
D:
\LEDA-4.4
\
- Restart Windows 95/98 for the change to take effect.
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_msc60_dll.txt |
txt-version of this section |
incl
\ |
the LEDA include directory |
man_html
\ |
HTML version of the LEDA user manual |
and at least one of the following dll/library sets
-
leda_ml.dll,
leda_ml.lib,
libGeoW_ml.lib
-
leda_mld.dll,
leda_mld.lib,
libGeoW_mld.lib
-
leda_md.dll,
leda_md.lib,
libGeoW_md.lib
-
leda_mdd.dll,
leda_mdd.lib,
libGeoW_mdd.lib
-
leda_mt.dll,
leda_mt.lib,
libGeoW_mt.lib
-
leda_mtd.dll,
leda_mtd.lib,
libGeoW_mtd.lib
Note: A DLL of GeoWin is currently not available.
Compiling and Linking in Microsoft Visual Studio 6
You can choose between a manual and an automatic way to compile and link an application
program using LEDA in Microsoft Visual Studio.
Include header file LEDA/msc/autolink_dll.h in one of your project's cpp-files.
Depending on your build environment (Debug or Release build) the correct LEDA dll will be chosen
automatically when you build your project. Proceed with step 18 of the manual setting.
- (1)
- In the "File" menu of Visual Studio 6 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)
- Click on "Properties->Add to Project->Files"
- (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 LEDA libraries that correspond to the
chosen flag, e.g., with option "/MD" you must use
leda_md.lib and leda_md.dll.
Using another library/DLL pair with "/MD" could lead to serious
linker errors.
- Add in "Preprocessor definitions" the compiler flag
"LEDA_DLL".
- (10)
- Choose "Linker" and add the name of the LEDA library you want to
use at the beginning of line "Object-/Library-Modules" as follows.
We use <opt> to indicate the compiler option chosen in
Step (9)
(, e.g., <opt> is mld for "/MLd"):
- leda_<opt>.lib
for programs not using GeoWin.
- libGeoW_<opt>.lib leda_<opt>.lib
for programs using GeoWin .
Alternatively, you can include <LEDA/msc/autolink_dll.h> in
your program and the correct LEDA library is linked to
your program automatically. If GeoWin is used you need to
add "_LINK_GeoW"
to the "Preprocessor definitions" in Step (9).
- (11)
- Click "OK" to leave the "Settings"
- (12)
- In the "Tools" menu click on "Options"
- (13)
- Choose "Directories"
- (14)
- Choose "Include Files" in "Show Directories for:" and add the
directory <LEDA>
\incl containing the LEDA
include files
(Double click on the small rectangle in "Directories", enter
<LEDA>
\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 <LEDA> containing the 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 the program "prog.exe" Windows needs to have
leda_<opt>.dll in its search path for DLL's. Therefore, you need
to do one of the following.
- Copy leda_<opt>.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_<opt>.dll as described 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 errors.
Examples of workspaces can be found in the directory
<LEDA>
\demo
\msc_60_workspaces.
To add LEDA to an existing Project in Microsoft Visual Studio 6, start the
Microsoft Visual Studio with your project and follow Steps (8)-(16) above.
- (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.
When Visual C++ was installed, setup created a batch file,
VCVARS32.BAT, containing commands to modify
PATH, LIB, and INCLUDE. Run
VCVARS32.BAT at the command prompt before you compile your application
program. VCVARS32.BAT is located in the
\bin subdirectory
of your compiler installation, e.g.,
c:
\programs
\microsoft visual studio 6
\vc98
\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:
-
- In the "Start" menu, point to "Settings", then click
"Control Panel".
- In the "Control Panel", double click "System".
- 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 <LEDA>
- extend INCLUDE by <LEDA>
\incl
- extend LIB by <LEDA>
Otherwise add new a user variable PATH, INCLUDE, or
LIB with value <LEDA>, respectively
<LEDA>
\incl.
- (ii) Windows 95/98:
-
- Change the file autoexec.bat as follows:
If a variable PATH, INCLUDE, or LIB
is already set, append the appropriate LEDA directory <LEDA>,
respectively
<LEDA>
\incl.
Otherwise add a corresponding line to autoexec.bat:
- set PATH=<LEDA>
- set INCLUDE=<LEDA>
\incl
- set LIB=<LEDA>
- Restart Windows 95/98 for the change to take effect.
After these procedures, it suffices to call VCVARS32.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 not using GeoWin:
cl <option> -DLEDA_DLL -Tp prog.c <libl.lib>
Programs using GeoWin:
cl <option> -DLEDA_DLL -Tp prog.c <libGeoW.lib> <libl.lib>
Possible values for <option> are "-ML", "-MLd", "-MD",
"-MDd", "-MT", and "-MTd". You have to use the LEDA libraries that
correspond to the chosen <option>, e.g., with option "-MD" you
must use leda_md.lib and libGeoW_md.lib.
Using another set of libraries with "-MD" could lead to serious
linker errors.
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.
The source code of all example and demo programs can be found in
the directory <LEDA>
\test and
<LEDA>
\demo.
Goto <LEDA> and type
make_test or make_demo to compile and link all test
or demo programs, respectively.
Next: Static Libraries for MS
Up: Technical Information
Previous: Static Libraries for MS
Contents
Index
root
2007-03-08