NAG Logo
Numerical Algorithms Group

Sample Microsoft Visual C++ Projects Illustrating How to Call the NAG C Library

This web page contains links to several zip files, each containing a Microsoft Visual Studio (Visual C++) project showing how to call a different NAG C Library function.

The projects were created using Microsoft Visual C++ version 7 from within Visual Studio .NET 2003, and have also been tested with Visual Studio 2005 (VC++ 8); they may not work with other versions of Visual C++. To run these projects under Visual Studio 2005, use the Visual Studio conversion wizard to convert the project. This will update the .sln and .vcproj files; the C/C++ code itself should remain the same.

The projects assume that the NAG C Library and associated material are installed in the folder C:\Program Files\NAG\CL08\cldll084zl. If this is not the case, you will need to modify the project settings for the configurations (i.e. Debug and/or Release) you are using. In particular:

  • on the Project | Properties dialog, under C/C++ | General, ensure that Additional Include Directories includes the location of the NAG C Library include folder, e.g.
    "C:\Program Files\NAG\CL08\cldll084zl\include"
    

  • on the Project | Properties dialog, under Linker | Input, ensure that Additional Dependencies includes the location of the NAG C import library, e.g.
    "C:\Program Files\NAG\CL08\cldll084zl\lib\CLDLL084Z_nag.lib"
    
    for use with the stand-alone NAG C Library DLL (CLDLL084Z_nag.dll), or
    "C:\Program Files\NAG\CL08\cldll084zl\lib\CLDLL084Z_mkl.lib"
    
    for use with the NAG C Library DLL using MKL BLAS and LAPACK functions (CLDLL084Z_mkl.dll).
The above instructions are for Visual Studio .NET 2003; setting the include and lib locations in other versions of Visual Studio may be different, e.g. under Visual Studio 2005 the C/C++ and Linker categories are located under the Configuration Properties category.

Note that these example projects contain both C and C++ source files (the C files containing slightly modified versions of the example programs from the examples\source folder). Because the C function is called from C++ code, the C function must be declared as extern "C" in the C++ code. For an example, see the files d01sjce.c and d01sjcDlg.cpp in the d01sjc project folder.

Remember also that to be able to run the program after you have compiled it, the NAG C Library DLL will need to appear somewhere in your current path. For example, if the DLLs are in C:\Program Files\NAG\CL08\cldll084zl\bin, then your PATH environment variable must contain this folder before starting Visual Studio. If you are using the MKL-based version of the NAG C Library (CLDLL084Z_mkl.dll), then the folder containing the MKL DLLs should also be on your path, but should appear later in the path than the bin folder for the NAG C Library DLLs, e.g.

C:\Program Files\NAG\CL08\cldll084zl\bin;C:\Program Files\NAG\CL08\
cldll084zl\MKL_ia32_8.0\bin;<rest of path>
© The Numerical Algorithms Group 2008
Privacy Policy | Trademarks

© Numerical Algorithms Group

Visit NAG on the web at:

www.nag.co.uk (Europe and ROW)
www.nag.com (North America)
www.nag-j.co.jp (Japan)

http://www.nag.co.uk/numeric/CL/classocinfo/VisualC++/README.asp