NAG Logo
Numerical Algorithms Group

Sample Borland Delphi Projects Illustrating How to Call the NAG C Library

This web page contains links to several zip files, each containing a Borland Delphi project showing how to call a different NAG C Library function.

The projects have been tested with Borland Developer Studio 2006 / Delphi for Microsoft Win32 Version 10.0 and may not work with other versions of Borland Delphi.

In each project, the source file nagc.pas shows how to create Pascal declarations of NAG C Library functions and types which map on to NAG C Library structures such as the fail structure. When creating your own Pascal declarations, it is important to ensure that correct argument types and semantics are used. For example, an argument declared as type "double *" in the NAG C Library function must be described as "var" in the Pascal declaration. A NAG C Library type double argument would be passed by value (i.e. not decribed as "var" in the Pascal declaration). See project files nagc.pas and d01sjce.pas in the d01sjc project folder for an example.

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. If the DLL is in C:\Program Files\NAG\CL08\cldll084zl\bin (for example), then your PATH environment variable must contain this folder before starting Delphi. 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>
Occasionally, when using the MKL-based DLL, the handling of floating-point exceptions may cause the program to terminate abnormally; if you experience such problems, it is recommended that you use the self-contained NAG DLL instead.

The projects listed here call the undocumented function x04mbc which converts a NAG error code string to its corresponding integer value. This function is equivalent to the function x04ncc which is new at Mark 8 of the NAG C Library.

© 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/Delphi/README.asp