If I want to definition proto file for followings
main.cpp
MyLib myLib;
MyAdapter::Create(){
myLib.create(this);
}
MyAdapter::OnInitialized(int result){
std::cout << "result:" << result << std::endl;
}
...
}
myLib.cpp(=libmy.so)
void My::create(ICreatorListener *listener);
ICreatorListener.h
class ICreatorListener{
public:
virtual void OnInitialized(int result) = 0;
}
My purpose is to exchange myLib's interface using google protobuf. Because I want to use mylib in c++ or java in universally. But I am not friendly google protobuf yet.
Question) Do I need define mylib.proto like followings? if so, how do I define for ICreatorListener *listener in mylib.proto? callback method is not supported in google protobuf?
MyLib.proto
message Result {
int value = 1;
}
main.cpp
MyAdapter::OnInitialized(const char* result){
int resultVal = getValueFromGoogleProtoBuf(result);
std::cout << "result:" << resultVal << std::endl;
}
ICreatorListener.h
class ICreatorListener{
public:
virtual void OnInitialized(const char* result) = 0;
}