Pass mgp_memory to custom Module.main_fn
Summary: Depends on D2495 Reviewers: mferencevic, dsantl Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2496
This commit is contained in:
parent
2e1063bbdb
commit
469102aa5e
@ -22,8 +22,8 @@ std::optional<Module> LoadModuleFromSharedLibrary(std::filesystem::path path) {
|
||||
return std::nullopt;
|
||||
}
|
||||
// Get required mgp_main
|
||||
module.main_fn = reinterpret_cast<void (*)(const mgp_list *,
|
||||
const mgp_graph *, mgp_result *)>(
|
||||
module.main_fn = reinterpret_cast<void (*)(
|
||||
const mgp_list *, const mgp_graph *, mgp_result *, mgp_memory *)>(
|
||||
dlsym(module.handle, "mgp_main"));
|
||||
const char *error = dlerror();
|
||||
if (!module.main_fn || error) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
struct mgp_graph;
|
||||
struct mgp_list;
|
||||
struct mgp_memory;
|
||||
struct mgp_result;
|
||||
|
||||
namespace query::procedure {
|
||||
@ -23,7 +24,8 @@ struct Module final {
|
||||
/// System handle to shared library.
|
||||
void *handle;
|
||||
/// Entry-point for module's custom procedure.
|
||||
std::function<void(const mgp_list *, const mgp_graph *, mgp_result *)>
|
||||
std::function<void(const mgp_list *, const mgp_graph *, mgp_result *,
|
||||
mgp_memory *)>
|
||||
main_fn;
|
||||
/// Optional initialization function called on module load.
|
||||
std::function<int()> init_fn;
|
||||
|
Loading…
Reference in New Issue
Block a user