// Part of the Concrete Compiler Project, under the BSD3 License with Zama // Exceptions. See // https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt // for license information. #ifndef CONCRETELANG_SERVERLIB_SERVER_LAMBDA_H #define CONCRETELANG_SERVERLIB_SERVER_LAMBDA_H #include #include "boost/outcome.h" #include "concretelang/ClientLib/ClientParameters.h" #include "concretelang/ClientLib/PublicArguments.h" #include "concretelang/ClientLib/Types.h" #include "concretelang/Common/Error.h" #include "concretelang/ServerLib/DynamicModule.h" namespace concretelang { namespace serverlib { using concretelang::clientlib::ScalarOrTensorData; /// ServerLambda is a utility class that allows to call a function of a /// compilation result. class ServerLambda { public: /// Load the symbol `funcName` from the shared lib in the artifacts folder /// located in `outputPath` static outcome::checked load(std::string funcName, std::string outputPath); /// Load the symbol `funcName` of the dynamic loaded library static outcome::checked loadFromModule(std::shared_ptr module, std::string funcName); /// Call the ServerLambda with public arguments. std::unique_ptr call(clientlib::PublicArguments &args, clientlib::EvaluationKeys &evaluationKeys); protected: ClientParameters clientParameters; void *(*func)(void *...); /// Retain module and open shared lib alive std::shared_ptr module; }; } // namespace serverlib } // namespace concretelang #endif