#include "rpc/rpc_client_c.h" #include "rpc/rpc_client_c_impl.h" #include #include extern "C" { RpcClient* rpc_client_create(const char* read_pipe, const char* write_pipe) { try { IpcPipeChannel* channel = new IpcPipeChannel(read_pipe, write_pipe); // Проверяем, что канал открылся успешно // (IpcPipeChannel может вывести ошибку, но не бросает исключение) // Для простоты считаем, что если конструктор завершился, всё ОК return new RpcClient(channel); } catch (...) { return nullptr; } } void rpc_client_destroy(RpcClient* client) { if (client) { delete client; } } IpcMarshallerHandle* rpc_client_create_marshaller(RpcClient* client, int object_id) { if (!client || !client->channel) { return nullptr; } try { IpcMarshaller* marshaller = new IpcMarshaller(*client->channel, object_id); return new IpcMarshallerHandle(marshaller); } catch (...) { return nullptr; } } void rpc_marshaller_destroy(IpcMarshallerHandle* marshaller) { if (marshaller) { delete marshaller; } } } // extern "C"