7.25.1. Overview¶
7.25.1.1. Summary¶
You can use Groonga as a library. You need to use the following APIs to initialize and finalize Groonga.
grn_init()
initializes Groonga.
In contrast, grn_fin()
finalizes Groonga.
You must call grn_init()
only once before you use APIs which
are provided by Groonga. You must call grn_fin()
only once
after you finish to use APIs which are provided by Groonga.
7.25.1.2. Example¶
Here is an example that uses Groonga as a full-text search library.
grn_rc rc;
/* It initializes resources used by Groonga. */
rc = grn_init();
if (rc != GRN_SUCCESS) {
return EXIT_FAILURE;
}
/* Some Groonga API calling codes... */
/* It releases resources used by Groonga. */
grn_fin();
return EXIT_SUCCESS;
7.25.1.3. Reference¶
-
grn_rc grn_init(void)¶
grn_init()
initializes resources that are used by Groonga. You must call it just once before you call other Groonga APIs.- Returns:
GRN_SUCCESS
on success, notGRN_SUCCESS
on error.
-
grn_rc grn_fin(void)¶
grn_fin()
releases resources that are used by Groonga. You can’t call other Groonga APIs after you callgrn_fin()
.- Returns:
GRN_SUCCESS
on success, notGRN_SUCCESS
on error.