Importing libraries.


C++ Server Pages allows the use of third party libraries. It is a fast and easy procedure of only a few steps:
  • Header files.
    Copy your library's header files (.h, .hpp etc.) in the include directory (typically "C:\Program Files\Micronovae\CSP\Engine\include").
  • Import library files
    Copy your import library files (.lib) in the lib directory (typically "C:\Program Files\Micronovae\CSP\Engine\lib").
  • Executable files
    If your library is not static, copy your executable files (.dll) in the dlls directory (typically "C:\Program Files\Micronovae\CSP\Engine\dlls").
  • Link import library
    In order for the library to be linked to a script, you have to use the C++ precompiler directive:
    #pragma comment( lib, "MyLibrary.lib" )
    This directive must be used in the Global Scope Section of the CSP script. Note: the GNU compiler currently does not support this precompiler directive.
    Also, if you want a library to be available for all the scripts, you can add your import library's filename (.lib) in the Linker Command Line field using the CSP Control Console.

For more information about include, lib and dlls directories, please see the CSP Control Console.

Important: The target compiler of your import library files (*.lib, *.a) must be the same with the target compiler of CSP Engine (MS VC++.NET 2003 Compiler, GNU C++ Compiler 3.3.3 and Borland C++ Compiler 5.5 currently supported). Also, if your library's dll exports C++ classes rather than just functions, the dll must have been built with the same compiler used by CSP Engine.

It is highly recommended that you do not use static libraries, because when they are used by many CSP scripts, they cause significant memory consumption. Use dynamically linked libraries (DLL) instead, that are shared among the CSP scripts.
Quick Overview | Online help home | Back
www.micronovae.com

Copyright © 2002 - 2005 Micronovae Ltd