|
1 | | -## Writing an SpringQL C application (embedded mode) |
| 1 | +## Example C applications |
2 | 2 |
|
3 | | -See [`example.c`](example.c) |
| 3 | +Most of applications under this directory are introduced in a [documentation page](https://springql.github.io/get-started/write-basic-apps). |
4 | 4 |
|
5 | | -## Building |
6 | | - |
7 | | -You need to put `springql.h` to an include path and `libspringql_client.{so,dylib}` to a library path first. Then, |
8 | | - |
9 | | -```bash |
10 | | -gcc example.c -lspringql_client -o run_example |
11 | | -``` |
12 | | - |
13 | | -If you haven't downloaded the header and shared library files, then, |
14 | | - |
15 | | -```bash |
16 | | -(cd ..; cargo build) # build shared library |
17 | | -gcc example.c -lspringql_client -o run_example -I.. -L../target/debug |
18 | | -``` |
19 | | - |
20 | | -You can also use CMake here. |
21 | | - |
22 | | -```bash |
23 | | -(cd ..; cargo build) # build shared library |
24 | | -cmake . && make |
25 | | -``` |
26 | | - |
27 | | -## Running the sample application |
28 | | - |
29 | | -First, you need to run a source server to generate trade data. |
30 | | -You may need to install `nc` (netcat) to your system. |
31 | | - |
32 | | -```bash |
33 | | -python print_trade.py | nc -l 19876 # running a source server on TCP port 19876 |
34 | | -``` |
35 | | - |
36 | | -Finally the example app runs. |
37 | | - |
38 | | -```bash |
39 | | -./run_example |
40 | | - |
41 | | -[row#0] ts=2021-11-23 05:38:32.589299000 amount=200 |
42 | | -[row#1] ts=2021-11-23 05:38:32.590267000 amount=100 |
43 | | -[row#2] ts=2021-11-23 05:38:32.590284000 amount=900 |
44 | | -[row#3] ts=2021-11-23 05:38:32.590295000 amount=500 |
45 | | -[row#4] ts=2021-11-23 05:38:32.590305000 amount=100 |
46 | | -``` |
| 5 | +Read it for building, running the apps. |
47 | 6 |
|
48 | 7 | ## License |
49 | 8 |
|
|
0 commit comments