Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
Plugin Loading

Load, register, and unload parser plugins. More...

Functions

ParserManagerStatus parser_manager_load (ParserManager *mgr, const char *path, void *user_data, LimePluginHandle *handle_out)
 Load a parser plugin from a shared library.
 
ParserManagerStatus parser_manager_register (ParserManager *mgr, const LimeParserPlugin *plugin, void *user_data, LimePluginHandle *handle_out)
 Register a statically linked parser plugin.
 
ParserManagerStatus parser_manager_unload (ParserManager *mgr, LimePluginHandle handle)
 Unload a previously loaded or registered plugin.
 

Detailed Description

Load, register, and unload parser plugins.

Function Documentation

◆ parser_manager_load()

ParserManagerStatus parser_manager_load ( ParserManager mgr,
const char *  path,
void *  user_data,
LimePluginHandle handle_out 
)

#include <include/parser_manager.h>

Load a parser plugin from a shared library.

The manager:

  1. dlopen()s the library
  2. Looks up the "lime_plugin_entry" symbol
  3. Calls it to get the LimeParserPlugin struct
  4. Validates ABI version compatibility
  5. Calls init(user_data) if provided
  6. Registers the plugin in the registry
Parameters
mgrThe parser manager.
pathFilesystem path to the shared library (.so / .dylib / .dll). If relative, the manager searches plugin_search_paths.
user_dataOpaque pointer passed to the plugin's init() callback. May be NULL.
[out]handle_outOn success, receives the handle for the loaded plugin.
Returns
PM_OK on success, or an error code.
See also
parser_manager_register() for statically linked plugins.
parser_manager_unload()

◆ parser_manager_register()

ParserManagerStatus parser_manager_register ( ParserManager mgr,
const LimeParserPlugin plugin,
void *  user_data,
LimePluginHandle handle_out 
)

#include <include/parser_manager.h>

Register a statically linked parser plugin.

Parameters
mgrThe parser manager.
pluginPointer to a LimeParserPlugin struct. Must remain valid until the plugin is unloaded.
user_dataOpaque pointer passed to the plugin's init() callback.
[out]handle_outOn success, receives the handle for the registered plugin.
Returns
PM_OK on success, or an error code.
See also
parser_manager_load() for shared library plugins.

◆ parser_manager_unload()

ParserManagerStatus parser_manager_unload ( ParserManager mgr,
LimePluginHandle  handle 
)

#include <include/parser_manager.h>

Unload a previously loaded or registered plugin.

Calls the plugin's destroy() callback and removes it from the registry. If the plugin was loaded from a shared library, the library is dlclose()'d after destroy() returns.

If the plugin is currently active, it is deactivated first. In-flight parse sessions that pinned a snapshot from this plugin are not affected (snapshots are refcounted).

Parameters
mgrThe parser manager.
handleHandle of the plugin to unload.
Returns
PM_OK on success, or an error code.