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:
Teon Banek 2019-10-17 10:52:14 +02:00
parent 2e1063bbdb
commit 469102aa5e
2 changed files with 5 additions and 3 deletions

View File

@ -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) {

View File

@ -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;