【发布时间】:2017-01-25 11:03:25
【问题描述】:
显然,protobuf 需要知道所有涉及的标头。
下面是Header.h的内容
Test.h是protobuf生成的头文件
#pragma once
#include "Test.h"
class TestClass
{
private:
test::Person _person;
public:
bool eventReceiveData(char*);
bool eventRecieveData(char* const);
bool eventRecieveData(std::string);
std::string getData() const;
void eventReceiveMessage(test::Person);
test::Person getPerson();
};
由于 Test.h 包含所有这些头文件,
#include <google/protobuf/stubs/common.h
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
这是否意味着我必须这样做?
%module Test
%{
#include "Header.h"
%}
%include "Header.h"
%include <google/protobuf/stubs/common.h>
%include <google/protobuf/arena.h>
%include <google/protobuf/arenastring.h>
%include <google/protobuf/generated_message_util.h>
%include <google/protobuf/metadata.h>
%include <google/protobuf/message.h>
%include <google/protobuf/repeated_field.h>
%include <google/protobuf/extension_set.h>
%include <google/protobuf/unknown_field_set.h>
另外,我是否必须包含 protobuf 的所有静态库?
我的目标语言是 C#
关于同时使用 swig 和 protobuf 的信息太少了。
【问题讨论】:
-
我大概可以回答这个问题,但是你为什么不把它序列化并通过 IPC 呢?
-
抱歉,我不知道我在做什么,哈哈
标签: c# c++ protocol-buffers swig