This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Using the TileDB C Library
Stavros Papadopoulos edited this page Feb 17, 2017
·
21 revisions
Here you can learn how to use the TileDB C Library when writing your own programs.
First, build the TileDB library as described in the Building TileDB section.
Now, let's create a simple program, called my_program.cc
#include <tiledb.h>
#include <cstdio>
int main () {
// Initialize TileDB context
TileDB_CTX* tiledb_ctx;
tiledb_ctx_init(&tiledb_ctx, NULL);
// Print version
printf("TileDB version: %s\n", TILEDB_VERSION);
// Finalize TileDB context
tiledb_ctx_finalize(tiledb_ctx);
return 0;
}
You can compile this program as follows:
g++ -c my_program.cc -o my_program.o
You can link the object file, creating the binary program, as follows:
g++ my_program.o -o my_program -ltiledb
Then run the program:
./my_program
TileDB Version: 0.5.2
The above should work given that the TileDB header files and libraries are in paths that your compiler can locate. Otherwise, make sure to include the TileDB header path with -I
and the library path with -L
when compiling and linking with TileDB. Also you may have to run
export LD_LIBRARY_PATH=<the TileDB library path>
in case your dynamic linker still cannot locate the TileDB shared library. Please contact us if you encounter any problems.