mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-22 01:10:03 +00:00
23 lines
685 B
C++
23 lines
685 B
C++
|
|
// Driver for the GENERATED native C++ bindings (my_timer_native.hpp).
|
||
|
|
// Uses the native (zero-serialization) ABI: typed structs in, typed structs out.
|
||
|
|
#include "my_timer_native.hpp"
|
||
|
|
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
try {
|
||
|
|
my_timer::My_timerNode node(my_timer::TimerConfig{"cpp-native-gen"});
|
||
|
|
std::cout << "version: " << node.Version() << "\n";
|
||
|
|
|
||
|
|
auto r = node.Echo(my_timer::EchoRequest{"hello from generated C++", 5});
|
||
|
|
std::cout << "echo: echoed=" << r.echoed << " timerName=" << r.timerName
|
||
|
|
<< "\n";
|
||
|
|
|
||
|
|
std::cout << "done.\n";
|
||
|
|
return 0;
|
||
|
|
} catch (const std::exception &e) {
|
||
|
|
std::cerr << "error: " << e.what() << "\n";
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
}
|