Compiling on Linux
This section provides instructions on how to compile shared objects and executable files on Linux. We will use RedHat as an example.
Compiling Shared Libraries
Prerequisites
Make sure you have an environment set up with:
yum install openssl-devel
yum install libuuid-devel
Download the code from the api-cplusplus project in Github. Take the main branch as an example, run the following commands in terminal:
git clone git@github.com:dolphindb/api-cplusplus.git
git checkout -b main origin/main
Compilation
Execute the following commands in terminal to compile libDolphinDBAPI.so:
cd path/to/api-cplusplus
mkdir build && cd build
cmake .. -DABI=0 -DUUID_PATH=/home/uuid/ -DUSE_OPENSSL=1 -DOPENSSL_PATH=/home/openssl/
make -j4
-D arguments of cmake
:
Compiling Executable Files
(1) Copy the DolphinDBAPI.so in the ../api-cplusplus/build (generated in Compiling Shared Libraries) into the demo/lib directory.
(2) Run the following commands in terminal:
cd path/to/api-cplusplus/demo
mkdir build && cd build
cmake .. -DABI=0 -DUSE_OPENSSL=1 -DOPENSSL_PATH=/home/openssl/
cmake --build .
The generated executable file apiDemo is stored in the demo/bin directory.