Compilation and Prerequisites

Compilation

Install the following dependencies before compiling:
  • zlib: execute command sudo apt-get install zlib1g-dev.

The libSwordfish.so library is located in the lib/abi_0/ or lib/abi_1/directory and compiled using g++-8.4.0. For optimal compatibility, it's recommended to compile your project using the same compiler version (g++-8.4.0). To use the clang compiler instead, ensure you include the compilation flag -stdlib=libstdc++.

Compile with the following commands.
mkdir build
cd build
cmake .. # For ABI 1 version, use: cmake -DABI=ON ..
make -j8

Executable File Execution

The executable file is generated in the build/bin directory. Before running the executable file, ensure the following files are present in the same location: dolphindb.dos, dolphindb.lic, dolphindb.cfg.

Note:
You can customize the settings in dolphindb.cfg file to match your particular needs. For detailed information on available configuration options, refer to DolphinDB Documentation > Configuration.

Runtime Initialization and Finalization

Before using Swordfish, call DolphinDBLib::initializeRuntime within the main function to initialize the runtime environment. After all operations are performed, you can call DolphinDBLib::finalizeRuntime to clean up the environment.
# include "Swordfish.h"
int main() {
    DolphinDBLib::initializeRuntime();

    // code implementation
    
    DolphinDBLib::finalizeRuntime();
    return 0;
}