0

我正在按照这个 repo为 DolphinDB 编写一个插件,我想传递一个用户定义的函数,如下所示:

在 cpp 中:

extern "C" ConstantSP funcInCpp(Heap* heap, vector<ConstantSP>& arguments);

在 DolphinDB 脚本中:

loadPlugin("...")
def g(x) { return x + 1 }
funcInCpp(g)

我怎样才能正确地做到这一点?

4

1 回答 1

0

您的脚本没有任何问题。在您的插件代码中,请将 ConstantSP 转换为 FunctionDefSP。

于 2019-06-29T01:31:22.283 回答