#docslug#/ecob/ecob/V1.1.0/ulmst2
OceanBase Embedded SQL in C (ECOB) is compatible with Oracle Pro*C. When you develop an application in C language, both ECOB and Pro*C enable you to directly embed SQL statements in the source code of the application. Then, the ecob precompiler program preprocesses the source code for complete semantic analysis and converts the embedded SQL statements and commands to call the function of the ecoblib runtime library. Finally, ECOB generates a source code file of the application in C language. This file is compiled and linked by the C language compiler and generated as an executable program.
After you install ECOB, you can precompile the .pc files and then compile and link the .c files.
Precompile the .pc files
When you use the ecob precompiler to compile .pc files to .c files, you can compile each .pc file separately. In general cases, you only need to specify the source files to be processed. The following statement shows the commands used to specify the source files to be processed.
ecob example.pc # Generate an example.c file.
cc example.c # Use the C language compiler to compile the file.
The following statement shows how to use the INCLUDE option to specify the header file to query and define a required macro.
ecob INCLUDE=/home/example/include INCLUDE=/usr/local/include DEFINE=MY_MACRO DEFINE=MY_MACRO=VALUE ONAME=main.c INAME=main.pc
Compile and link the .c file
After you use the ecob precompiler to compile the .pc file to a .c file, you need to use the C language compiler, for example, cc, to compile and link the .c file. When you link the .c file, you need to use the ecoblib runtime library (libecob.so and libpq.so) and the OceanBase Call Interface (OBCI) library. By default, libobci.so is installed under the /u01/obclient/lib path. The following statement shows a sample. For more examples, see ECOB Application Development Guide.
-lecob -lpq -lobci -lmysqlclient -L/u01/obclient/lib/