func names are no longer mangled to death

This commit is contained in:
2025-08-25 18:22:23 -05:00
parent e626c94f4a
commit d0c1d9fb93
4 changed files with 86 additions and 24 deletions

View File

@@ -54,7 +54,7 @@
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
@@ -66,7 +66,7 @@
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
@@ -109,6 +109,19 @@
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir> <OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir> <IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
<SourcePath>$(ProjectDir)src;$(SourcePath)</SourcePath> <SourcePath>$(ProjectDir)src;$(SourcePath)</SourcePath>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -166,6 +179,12 @@
<PostBuildEvent> <PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)"</Command> <Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)"</Command>
</PostBuildEvent> </PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
<ClCompile> <ClCompile>
@@ -183,6 +202,16 @@
<PostBuildEvent> <PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)"</Command> <Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)"</Command>
</PostBuildEvent> </PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@@ -199,6 +228,9 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PostBuildEvent>
<Command>xcopy /y "$(ProjectDir)poses.csv" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\vertex.glsl" "$(OutDir)" &amp;&amp; xcopy /y "$(ProjectDir)src\shaders\fragment.glsl" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\body.cpp" /> <ClCompile Include="src\body.cpp" />
@@ -210,6 +242,14 @@
<ClCompile Include="src\shaders.cpp" /> <ClCompile Include="src\shaders.cpp" />
<ClCompile Include="src\util.cpp" /> <ClCompile Include="src\util.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="inc\body.hpp" />
<ClInclude Include="inc\camera.hpp" />
<ClInclude Include="inc\camera_poses.hpp" />
<ClInclude Include="inc\live_plotter.hpp" />
<ClInclude Include="inc\shaders.hpp" />
<ClInclude Include="inc\util.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -40,4 +40,24 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="inc\body.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\camera.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\camera_poses.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\live_plotter.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\shaders.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\util.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>

View File

@@ -4,11 +4,13 @@
typedef unsigned long long pointid; typedef unsigned long long pointid;
DllExport bool __cdecl start(int win_w, int win_h); extern "C" {
DllExport bool __cdecl stop(); DllExport bool __cdecl start(int win_w, int win_h);
DllExport pointid __cdecl create_point(float x, float y, float z); DllExport bool __cdecl stop();
DllExport void __cdecl set_color(pointid id, float r, float g, float b); DllExport pointid __cdecl create_point(float x, float y, float z);
DllExport void __cdecl set_scale(pointid id, float scale); DllExport void __cdecl set_color(pointid id, float r, float g, float b);
DllExport void __cdecl update_point(pointid id, float x, float y, float z); DllExport void __cdecl set_scale(pointid id, float scale);
DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s); DllExport void __cdecl update_point(pointid id, float x, float y, float z);
DllExport void __cdecl clear_point(pointid id); DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s);
DllExport void __cdecl clear_point(pointid id);
}

View File

@@ -54,8 +54,8 @@ static std::map<uint, Point*> id_to_point; // Use a pool allocator possibly late
static std::map<Point*, uint> point_to_id; static std::map<Point*, uint> point_to_id;
// Constants // Constants
const char* vertex_filepath = "src/shaders/vertex.glsl"; const char* vertex_filepath = "vertex.glsl";
const char* fragment_filepath = "src/shaders/fragment.glsl"; const char* fragment_filepath = "fragment.glsl";
// Private foward decls // Private foward decls
void _resize_cb(GLFWwindow* win, int w, int h); void _resize_cb(GLFWwindow* win, int w, int h);
@@ -67,7 +67,7 @@ bool _glfw_setup();
void _refresh_win(); void _refresh_win();
double _time(); 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)) if (!InitializeCriticalSectionAndSpinCount(&cs, 0x00000400))
return false; return false;
@@ -92,7 +92,7 @@ DllExport bool __cdecl start(int win_w, int win_h) {
return running; return running;
} }
DllExport bool __cdecl stop() { extern DllExport bool __cdecl stop() {
stop_flag = true; stop_flag = true;
DWORD res = WaitForSingleObject(win_thread_h, STOP_WAIT_TIME_MS); DWORD res = WaitForSingleObject(win_thread_h, STOP_WAIT_TIME_MS);
bool success = res == WAIT_OBJECT_0; bool success = res == WAIT_OBJECT_0;
@@ -103,7 +103,7 @@ DllExport bool __cdecl stop() {
return success; 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); EnterCriticalSection(&cs);
Point* p = (Point*)malloc(sizeof(Point)); Point* p = (Point*)malloc(sizeof(Point));
@@ -124,21 +124,21 @@ DllExport pointid __cdecl create_point(float x, float y, float z) {
return id; 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); EnterCriticalSection(&cs);
Point* p = id_to_point[id]; Point* p = id_to_point[id];
p->b.color = { r, g, b, p->b.color[3] }; p->b.color = { r, g, b, p->b.color[3] };
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
} }
DllExport void __cdecl set_scale(pointid id, float scale) { extern DllExport void __cdecl set_scale(pointid id, float scale) {
EnterCriticalSection(&cs); EnterCriticalSection(&cs);
Point* p = id_to_point[id]; Point* p = id_to_point[id];
p->b.scale = scale; p->b.scale = scale;
LeaveCriticalSection(&cs); 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); EnterCriticalSection(&cs);
Point* p = id_to_point[id]; Point* p = id_to_point[id];
p->targetloc = { x, y, z }; p->targetloc = { x, y, z };
@@ -147,7 +147,7 @@ DllExport void __cdecl update_point(pointid id, float x, float y, float z) {
LeaveCriticalSection(&cs); 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); EnterCriticalSection(&cs);
Point* p = id_to_point[id]; Point* p = id_to_point[id];
p->start_s = _time(); p->start_s = _time();
@@ -155,7 +155,7 @@ DllExport void __cdecl set_lifetime(pointid id, float new_lifetime_s) {
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
} }
DllExport void __cdecl clear_point(pointid id) { extern DllExport void __cdecl clear_point(pointid id) {
EnterCriticalSection(&cs); EnterCriticalSection(&cs);
Point* p = id_to_point[id]; Point* p = id_to_point[id];
id_to_point.erase(id); id_to_point.erase(id);