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

The information here is applicable to the DLLs supplied with CLW3209DAL.

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 Visual Studio 2005 (Visual C++ 8*), and have also been tested with Visual Studio 2008 (VC++ 9**) and Visual Studio 2010 (VC++ 10***); they may not work with other versions of Visual C++. To run these projects under Visual Studio 2008 and 2010, 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\CL09\clw3209dal. 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:

  • under the project's Properties | Configuration Properties | C/C++ | General, ensure that Additional Include Directories includes the location of the NAG C Library include folder, e.g.
    "C:\Program Files\NAG\CL09\clw3209dal\include"


  • under the project's Properties | Configuration Properties | Linker | Input, ensure that Additional Dependencies includes the location of the NAG C import library, e.g.
    "C:\Program Files\NAG\CL09\clw3209dal\lib\CLW3209DA_nag.lib"
    for use with the stand-alone NAG C Library DLL (CLW3209DA_nag.dll), or
    "C:\Program Files\NAG\CL09\clw3209dal\lib\CLW3209DA_mkl.lib"
    for use with the NAG C Library DLL using MKL BLAS and LAPACK functions (CLW3209DA_mkl.dll).

The above instructions are for Visual Studio 2005, Visual Studio 2008 and Visual Studio 2010; setting the include and lib locations in other versions of Visual Studio may be different.

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\CL09\clw3209dal\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 (CLW3209DA_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\CL09\clw209dal\bin;C:\Program Files\NAG\CL09\
clw3209dal\MKL_ia32_10.2\bin;<rest of path>

* Microsoft C/C++ Compiler Version 14.00
** Microsoft C/C++ Compiler Version 15.00
*** Microsoft C/C++ Compiler Version 16.00