From 1b7e2408a10653756bc25d782dd6d0a76ac0887f Mon Sep 17 00:00:00 2001 From: Krishna Ayyalasomayajula Date: Wed, 18 Feb 2026 20:11:11 -0600 Subject: [PATCH] ready for first test --- CMakeLists.txt | 8 ++++++-- src/main.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e6a35b..4952b53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,10 +15,11 @@ if(NOT CMAKE_BUILD_TYPE) endif() # -------------------------------------------------- -# External dependency: spdlog +# External dependency: spdlog + LLU # -------------------------------------------------- add_subdirectory(external/spdlog) add_subdirectory(external/LibraryLinkUtilities) + # -------------------------------------------------- # Executable # -------------------------------------------------- @@ -38,7 +39,10 @@ foreach(dir ${SRC_SUBDIRS}) endif() endforeach() -target_include_directories(${PROJECT_NAME} PRIVATE ${SRC_INCLUDES}) +target_include_directories(${PROJECT_NAME} PRIVATE + ${SRC_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/external/LibraryLinkUtilities/include +) # -------------------------------------------------- # Auto-discover all .cpp except main.cpp diff --git a/src/main.cpp b/src/main.cpp index 93d55bf..58be517 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,40 @@ -int main (int argc, char *argv[]) { - - return 0; +#include "spdlog/spdlog.h" +extern "C" { +#include +} +#include + +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(args), + const_cast(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 stream(mlp); + + stream << 42 << LLU::WS::Flush; + + WSClose(mlp); + WSDeinitialize(env); + spdlog::info("Done"); + return 0; }