From d0c1d9fb93a5bc3c43d059872af30d87509157db Mon Sep 17 00:00:00 2001 From: Seth Hamilton Date: Mon, 25 Aug 2025 18:22:23 -0500 Subject: [PATCH] func names are no longer mangled to death --- LivePlotter.vcxproj | 50 +++++++++++++++++++++++++++++++++---- LivePlotter.vcxproj.filters | 20 +++++++++++++++ inc/live_plotter.hpp | 20 ++++++++------- src/live_plotter.cpp | 20 +++++++-------- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/LivePlotter.vcxproj b/LivePlotter.vcxproj index 6e2734c..a05e07b 100644 --- a/LivePlotter.vcxproj +++ b/LivePlotter.vcxproj @@ -54,7 +54,7 @@ Unicode - Application + DynamicLibrary true v143 Unicode @@ -66,7 +66,7 @@ Unicode - Application + DynamicLibrary false v143 true @@ -109,6 +109,19 @@ $(ProjectDir)bin\$(Platform)\$(Configuration)\ $(ProjectDir)obj\$(Platform)\$(Configuration)\ $(ProjectDir)src;$(SourcePath) + + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" + + + xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" + + + xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)" + + + + $(ProjectDir)bin\$(Platform)\$(Configuration)\ + $(ProjectDir)obj\$(Platform)\$(Configuration)\ @@ -164,7 +177,13 @@ glfw3.lib;opengl32.lib;%(AdditionalDependencies) - xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" + + + xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" + + + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)" @@ -181,8 +200,18 @@ glfw3.lib;opengl32.lib;%(AdditionalDependencies) - xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" + + xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" + + + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)" + + + + + @@ -199,6 +228,9 @@ true true + + xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" && xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)" + @@ -210,7 +242,15 @@ + + + + + + + + - + \ No newline at end of file diff --git a/LivePlotter.vcxproj.filters b/LivePlotter.vcxproj.filters index 41e5b53..dfda0af 100644 --- a/LivePlotter.vcxproj.filters +++ b/LivePlotter.vcxproj.filters @@ -40,4 +40,24 @@ Source Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/inc/live_plotter.hpp b/inc/live_plotter.hpp index 3a7039e..5acc11e 100644 --- a/inc/live_plotter.hpp +++ b/inc/live_plotter.hpp @@ -1,14 +1,16 @@ #pragma once -#define DllExport __declspec( dllexport ) +#define DllExport __declspec( dllexport ) typedef unsigned long long pointid; -DllExport bool __cdecl start(int win_w, int win_h); -DllExport bool __cdecl stop(); -DllExport pointid __cdecl create_point(float x, float y, float z); -DllExport void __cdecl set_color(pointid id, float r, float g, float b); -DllExport void __cdecl set_scale(pointid id, float scale); -DllExport void __cdecl update_point(pointid id, float x, float y, float z); -DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s); -DllExport void __cdecl clear_point(pointid id); +extern "C" { + DllExport bool __cdecl start(int win_w, int win_h); + DllExport bool __cdecl stop(); + DllExport pointid __cdecl create_point(float x, float y, float z); + DllExport void __cdecl set_color(pointid id, float r, float g, float b); + DllExport void __cdecl set_scale(pointid id, float scale); + DllExport void __cdecl update_point(pointid id, float x, float y, float z); + DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s); + DllExport void __cdecl clear_point(pointid id); +} \ No newline at end of file diff --git a/src/live_plotter.cpp b/src/live_plotter.cpp index 5b9a0dc..310ac5c 100644 --- a/src/live_plotter.cpp +++ b/src/live_plotter.cpp @@ -54,8 +54,8 @@ static std::map id_to_point; // Use a pool allocator possibly late static std::map point_to_id; // Constants -const char* vertex_filepath = "src/shaders/vertex.glsl"; -const char* fragment_filepath = "src/shaders/fragment.glsl"; +const char* vertex_filepath = "vertex.glsl"; +const char* fragment_filepath = "fragment.glsl"; // Private foward decls void _resize_cb(GLFWwindow* win, int w, int h); @@ -67,7 +67,7 @@ bool _glfw_setup(); void _refresh_win(); double _time(); -DllExport bool __cdecl start(int win_w, int win_h) { +extern DllExport bool __cdecl start(int win_w, int win_h) { if (!InitializeCriticalSectionAndSpinCount(&cs, 0x00000400)) return false; @@ -92,7 +92,7 @@ DllExport bool __cdecl start(int win_w, int win_h) { return running; } -DllExport bool __cdecl stop() { +extern DllExport bool __cdecl stop() { stop_flag = true; DWORD res = WaitForSingleObject(win_thread_h, STOP_WAIT_TIME_MS); bool success = res == WAIT_OBJECT_0; @@ -103,7 +103,7 @@ DllExport bool __cdecl stop() { return success; } -DllExport pointid __cdecl create_point(float x, float y, float z) { +extern DllExport pointid __cdecl create_point(float x, float y, float z) { EnterCriticalSection(&cs); Point* p = (Point*)malloc(sizeof(Point)); @@ -124,21 +124,21 @@ DllExport pointid __cdecl create_point(float x, float y, float z) { return id; } -DllExport void __cdecl set_color(pointid id, float r, float g, float b) { +extern DllExport void __cdecl set_color(pointid id, float r, float g, float b) { EnterCriticalSection(&cs); Point* p = id_to_point[id]; p->b.color = { r, g, b, p->b.color[3] }; LeaveCriticalSection(&cs); } -DllExport void __cdecl set_scale(pointid id, float scale) { +extern DllExport void __cdecl set_scale(pointid id, float scale) { EnterCriticalSection(&cs); Point* p = id_to_point[id]; p->b.scale = scale; LeaveCriticalSection(&cs); } -DllExport void __cdecl update_point(pointid id, float x, float y, float z) { +extern DllExport void __cdecl update_point(pointid id, float x, float y, float z) { EnterCriticalSection(&cs); Point* p = id_to_point[id]; p->targetloc = { x, y, z }; @@ -147,7 +147,7 @@ DllExport void __cdecl update_point(pointid id, float x, float y, float z) { LeaveCriticalSection(&cs); } -DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s) { +extern DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s) { EnterCriticalSection(&cs); Point* p = id_to_point[id]; p->start_s = _time(); @@ -155,7 +155,7 @@ DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s) { LeaveCriticalSection(&cs); } -DllExport void __cdecl clear_point(pointid id) { +extern DllExport void __cdecl clear_point(pointid id) { EnterCriticalSection(&cs); Point* p = id_to_point[id]; id_to_point.erase(id);