1/* -*- c-basic-offset: 2 -*- */
2/*
3 Copyright(C) 2010-2016 Brazil
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License version 2.1 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#pragma once
20
21#include "grn.h"
22#include "grn_ctx.h"
23#include "grn_store.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#ifdef WIN32
30typedef HINSTANCE grn_dl;
31typedef FARPROC grn_dl_symbol;
32
33#else
34typedef void * grn_dl;
35typedef void * grn_dl_symbol;
36#endif
37
38typedef struct _grn_plugin grn_plugin;
39
40struct _grn_plugin {
41 char path[PATH_MAX];
42 grn_dl dl;
43 grn_plugin_func init_func;
44 grn_plugin_func register_func;
45 grn_plugin_func unregister_func;
46 grn_plugin_func fin_func;
47 int refcount;
48};
49
50void grn_plugin_init_from_env(void);
51grn_rc grn_plugins_init(void);
52grn_rc grn_plugins_fin(void);
53grn_id grn_plugin_open(grn_ctx *ctx, const char *filename);
54grn_rc grn_plugin_close(grn_ctx *ctx, grn_id id);
55grn_id grn_plugin_reference(grn_ctx *ctx, const char *filename);
56const char *grn_plugin_path(grn_ctx *ctx, grn_id id);
57char *grn_plugin_find_path(grn_ctx *ctx, const char *name);
58void grn_plugin_ensure_registered(grn_ctx *ctx, grn_obj *proc);
59
60#ifdef __cplusplus
61}
62#endif
63