feat: working operatorDef transfer
This commit is contained in:
@@ -8,3 +8,5 @@ void enzo::op::OperatorTable::addOperator(nt::opConstructor ctorFunc)
|
||||
// ctorFunc(5);
|
||||
ctorStore_.push_back(ctorFunc);
|
||||
}
|
||||
|
||||
std::vector<enzo::nt::opConstructor> enzo::op::OperatorTable::ctorStore_;
|
||||
|
||||
@@ -8,8 +8,9 @@ namespace enzo::op
|
||||
class BOOST_SYMBOL_EXPORT OperatorTable
|
||||
{
|
||||
public:
|
||||
void addOperator(nt::opConstructor ctorFunc);
|
||||
static void addOperator(nt::opConstructor ctorFunc);
|
||||
private:
|
||||
std::vector<nt::opConstructor> ctorStore_;
|
||||
static std::vector<nt::opConstructor> ctorStore_;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
extern "C"
|
||||
{ BOOST_SYMBOL_EXPORT std::string myVar = "hello world";
|
||||
BOOST_SYMBOL_EXPORT void newSopOperator(enzo::op::OperatorTable* table)
|
||||
BOOST_SYMBOL_EXPORT void newSopOperator(void (*addOperator)(enzo::nt::opConstructor))
|
||||
{
|
||||
table->addOperator(
|
||||
addOperator(
|
||||
&GopTransform::ctor
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <oneapi/tbb/parallel_for.h>
|
||||
#include <iostream>
|
||||
#include <boost/dll/import.hpp>
|
||||
#include "Engine/Network/NetworkManager.h"
|
||||
#include "Engine/Operator/OperatorTable.h"
|
||||
|
||||
TEST_CASE("foo")
|
||||
{
|
||||
@@ -33,10 +35,10 @@ TEST_CASE("boost dll")
|
||||
);
|
||||
std::cout << "VAR: " << *cpp_var << "\n";
|
||||
|
||||
auto cpp11_func = boost::dll::import_symbol<void(int&&)>(
|
||||
auto cpp11_func = boost::dll::import_symbol<void(void (*addOperator)(enzo::nt::opConstructor))>(
|
||||
"build/src/OpDefs/libenzoOps1.so", "newSopOperator"
|
||||
);
|
||||
|
||||
cpp11_func(5);
|
||||
cpp11_func(enzo::op::OperatorTable::addOperator);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user