ready for first test
This commit is contained in:
42
src/main.cpp
42
src/main.cpp
@@ -1,4 +1,40 @@
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
return 0;
|
||||
#include "spdlog/spdlog.h"
|
||||
extern "C" {
|
||||
#include <wstp.h>
|
||||
}
|
||||
#include <LLU/WSTP/WSStream.hpp>
|
||||
|
||||
int main() {
|
||||
WSEnvironment env = WSInitialize(nullptr);
|
||||
if (!env) {
|
||||
spdlog::error("Failed to initialize WSTP environment");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* args[] = {
|
||||
"client",
|
||||
"-linkname", "1240@localhost",
|
||||
"-linkprotocol", "TCPIP",
|
||||
"-linkmode", "connect"
|
||||
};
|
||||
int err = 0;
|
||||
|
||||
WSLINK mlp = WSOpenArgv(env,
|
||||
const_cast<char**>(args),
|
||||
const_cast<char**>(args) + (sizeof(args)/sizeof(args[0])),
|
||||
&err);
|
||||
if (!mlp || err != WSEOK) {
|
||||
spdlog::error("Failed to open WSTP link (err={})", err);
|
||||
WSDeinitialize(env);
|
||||
return 1;
|
||||
}
|
||||
|
||||
LLU::WSStream<LLU::WS::Encoding::Native, LLU::WS::Encoding::Native> stream(mlp);
|
||||
|
||||
stream << 42 << LLU::WS::Flush;
|
||||
|
||||
WSClose(mlp);
|
||||
WSDeinitialize(env);
|
||||
spdlog::info("Done");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user