improve example

master
Сергей Маринкевич 2 months ago
parent 0334b9a42b
commit 31d0496a93

@ -1,5 +1,10 @@
#include "MyService.h"
int MyService::add(int a, int b) {
return a + b;
counter_ += (a + b);
return counter_;
}
int MyService::get() {
return counter_;
}

@ -5,8 +5,13 @@
// annotate with clang attribute or via comment annotation recognized by libclang
// Use ANNOTATE attribute supported by clang: __attribute__((annotate("export")))
class RPC_EXPORT MyService {
private:
int counter_ = 0;
public:
RPC_EXPORT
int add(int a, int b);
RPC_EXPORT
int get();
int minus(int a, int b);
};

@ -20,6 +20,7 @@ int main() {
ProxyMarshaller marshaller(ch);
MyServiceProxy proxy(marshaller);
int r = proxy.add(7, 9);
std::cout << "RESULT: " << r << std::endl;
proxy.add(7, 9);
int counter = proxy.get();
std::cout << "RESULT: " << counter << std::endl;
}

Loading…
Cancel
Save