Skip to content

Commit 0a0cded

Browse files
committed
Fix cross-platform CI failures and Windows DLL exports
- Add pyyaml dependency to requirements.txt and setup.py - Implement Windows DLL export macros (PYHELIOS_API) for all functions - Fix type consistency between header and implementation files - Add robust error handling for visualizer and WeberPennTree tests - Clear platform-specific config interference in plugin system tests Resolves segmentation faults on macOS/Linux and "function not found" errors on Windows CI builds.
1 parent 8b39024 commit 0a0cded

2 files changed

Lines changed: 32 additions & 30 deletions

File tree

native/include/pyhelios_wrapper.h

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ extern "C" {
2525
#endif
2626

2727
// Forward declarations for C interface
28-
typedef struct helios_Context helios_Context;
29-
typedef struct Visualizer Visualizer;
30-
typedef struct WeberPennTree WeberPennTree;
28+
namespace helios {
29+
class Context;
30+
}
31+
class Visualizer;
32+
class WeberPennTree;
3133

3234
//=============================================================================
3335
// Error Handling Functions
@@ -58,39 +60,39 @@ PYHELIOS_API void clearError();
5860
* @brief Create a new Helios Context
5961
* @return Pointer to the created Context
6062
*/
61-
PYHELIOS_API helios_Context* createContext();
63+
PYHELIOS_API helios::Context* createContext();
6264

6365
/**
6466
* @brief Destroy a Helios Context
6567
* @param context Pointer to the Context to destroy
6668
*/
67-
PYHELIOS_API void destroyContext(helios_Context* context);
69+
PYHELIOS_API void destroyContext(helios::Context* context);
6870

6971
/**
7072
* @brief Mark geometry as clean
7173
* @param context Pointer to the Context
7274
*/
73-
PYHELIOS_API void markGeometryClean(helios_Context* context);
75+
PYHELIOS_API void markGeometryClean(helios::Context* context);
7476

7577
/**
7678
* @brief Mark geometry as dirty
7779
* @param context Pointer to the Context
7880
*/
79-
PYHELIOS_API void markGeometryDirty(helios_Context* context);
81+
PYHELIOS_API void markGeometryDirty(helios::Context* context);
8082

8183
/**
8284
* @brief Check if geometry is dirty
8385
* @param context Pointer to the Context
8486
* @return true if geometry is dirty, false otherwise
8587
*/
86-
PYHELIOS_API bool isGeometryDirty(helios_Context* context);
88+
PYHELIOS_API bool isGeometryDirty(helios::Context* context);
8789

8890
/**
8991
* @brief Add a default patch to the context
9092
* @param context Pointer to the Context
9193
* @return UUID of the created patch
9294
*/
93-
PYHELIOS_API unsigned int addPatch(helios_Context* context);
95+
PYHELIOS_API unsigned int addPatch(helios::Context* context);
9496

9597
/**
9698
* @brief Add a patch with center and size
@@ -99,7 +101,7 @@ PYHELIOS_API unsigned int addPatch(helios_Context* context);
99101
* @param size Array of 2 floats [width, height] for patch size
100102
* @return UUID of the created patch
101103
*/
102-
PYHELIOS_API unsigned int addPatchWithCenterAndSize(helios_Context* context, float* center, float* size);
104+
PYHELIOS_API unsigned int addPatchWithCenterAndSize(helios::Context* context, float* center, float* size);
103105

104106
/**
105107
* @brief Add a patch with center, size, and rotation
@@ -109,7 +111,7 @@ PYHELIOS_API unsigned int addPatchWithCenterAndSize(helios_Context* context, flo
109111
* @param rotation Array of 3 floats [radius, elevation, azimuth] for patch rotation
110112
* @return UUID of the created patch
111113
*/
112-
PYHELIOS_API unsigned int addPatchWithCenterSizeAndRotation(helios_Context* context, float* center, float* size, float* rotation);
114+
PYHELIOS_API unsigned int addPatchWithCenterSizeAndRotation(helios::Context* context, float* center, float* size, float* rotation);
113115

114116
/**
115117
* @brief Add a patch with center, size, rotation, and RGB color
@@ -120,7 +122,7 @@ PYHELIOS_API unsigned int addPatchWithCenterSizeAndRotation(helios_Context* cont
120122
* @param color Array of 3 floats [r, g, b] for patch color
121123
* @return UUID of the created patch
122124
*/
123-
PYHELIOS_API unsigned int addPatchWithCenterSizeRotationAndColor(helios_Context* context, float* center, float* size, float* rotation, float* color);
125+
PYHELIOS_API unsigned int addPatchWithCenterSizeRotationAndColor(helios::Context* context, float* center, float* size, float* rotation, float* color);
124126

125127
/**
126128
* @brief Add a patch with center, size, rotation, and RGBA color
@@ -131,31 +133,31 @@ PYHELIOS_API unsigned int addPatchWithCenterSizeRotationAndColor(helios_Context*
131133
* @param color Array of 4 floats [r, g, b, a] for patch color
132134
* @return UUID of the created patch
133135
*/
134-
PYHELIOS_API unsigned int addPatchWithCenterSizeRotationAndColorRGBA(helios_Context* context, float* center, float* size, float* rotation, float* color);
136+
PYHELIOS_API unsigned int addPatchWithCenterSizeRotationAndColorRGBA(helios::Context* context, float* center, float* size, float* rotation, float* color);
135137

136138
/**
137139
* @brief Get the type of a primitive
138140
* @param context Pointer to the Context
139141
* @param uuid UUID of the primitive
140142
* @return Primitive type as integer
141143
*/
142-
PYHELIOS_API unsigned int getPrimitiveType(helios_Context* context, unsigned int uuid);
144+
PYHELIOS_API unsigned int getPrimitiveType(helios::Context* context, unsigned int uuid);
143145

144146
/**
145147
* @brief Get the area of a primitive
146148
* @param context Pointer to the Context
147149
* @param uuid UUID of the primitive
148150
* @return Area of the primitive
149151
*/
150-
PYHELIOS_API float getPrimitiveArea(helios_Context* context, unsigned int uuid);
152+
PYHELIOS_API float getPrimitiveArea(helios::Context* context, unsigned int uuid);
151153

152154
/**
153155
* @brief Get the normal vector of a primitive
154156
* @param context Pointer to the Context
155157
* @param uuid UUID of the primitive
156158
* @return Pointer to array of 3 floats [x, y, z] for normal vector
157159
*/
158-
PYHELIOS_API float* getPrimitiveNormal(helios_Context* context, unsigned int uuid);
160+
PYHELIOS_API float* getPrimitiveNormal(helios::Context* context, unsigned int uuid);
159161

160162
/**
161163
* @brief Get the vertices of a primitive
@@ -164,61 +166,61 @@ PYHELIOS_API float* getPrimitiveNormal(helios_Context* context, unsigned int uui
164166
* @param size Pointer to store the number of vertices
165167
* @return Pointer to array of vertex coordinates
166168
*/
167-
PYHELIOS_API float* getPrimitiveVertices(helios_Context* context, unsigned int uuid, unsigned int* size);
169+
PYHELIOS_API float* getPrimitiveVertices(helios::Context* context, unsigned int uuid, unsigned int* size);
168170

169171
/**
170172
* @brief Get the color of a primitive (RGB)
171173
* @param context Pointer to the Context
172174
* @param uuid UUID of the primitive
173175
* @return Pointer to array of 3 floats [r, g, b]
174176
*/
175-
PYHELIOS_API float* getPrimitiveColor(helios_Context* context, unsigned int uuid);
177+
PYHELIOS_API float* getPrimitiveColor(helios::Context* context, unsigned int uuid);
176178

177179
/**
178180
* @brief Get the RGB color of a primitive
179181
* @param context Pointer to the Context
180182
* @param uuid UUID of the primitive
181183
* @return Pointer to array of 3 floats [r, g, b]
182184
*/
183-
PYHELIOS_API float* getPrimitiveColorRGB(helios_Context* context, unsigned int uuid);
185+
PYHELIOS_API float* getPrimitiveColorRGB(helios::Context* context, unsigned int uuid);
184186

185187
/**
186188
* @brief Get the RGBA color of a primitive
187189
* @param context Pointer to the Context
188190
* @param uuid UUID of the primitive
189191
* @return Pointer to array of 4 floats [r, g, b, a]
190192
*/
191-
PYHELIOS_API float* getPrimitiveColorRGBA(helios_Context* context, unsigned int uuid);
193+
PYHELIOS_API float* getPrimitiveColorRGBA(helios::Context* context, unsigned int uuid);
192194

193195
/**
194196
* @brief Get the total number of primitives in the context
195197
* @param context Pointer to the Context
196198
* @return Number of primitives
197199
*/
198-
PYHELIOS_API unsigned int getPrimitiveCount(helios_Context* context);
200+
PYHELIOS_API unsigned int getPrimitiveCount(helios::Context* context);
199201

200202
/**
201203
* @brief Get all primitive UUIDs in the context
202204
* @param context Pointer to the Context
203205
* @param size Pointer to store the number of UUIDs
204206
* @return Pointer to array of UUIDs
205207
*/
206-
PYHELIOS_API unsigned int* getAllUUIDs(helios_Context* context, unsigned int* size);
208+
PYHELIOS_API unsigned int* getAllUUIDs(helios::Context* context, unsigned int* size);
207209

208210
/**
209211
* @brief Get the total number of objects in the context
210212
* @param context Pointer to the Context
211213
* @return Number of objects
212214
*/
213-
PYHELIOS_API unsigned int getObjectCount(helios_Context* context);
215+
PYHELIOS_API unsigned int getObjectCount(helios::Context* context);
214216

215217
/**
216218
* @brief Get all object IDs in the context
217219
* @param context Pointer to the Context
218220
* @param size Pointer to store the number of object IDs
219221
* @return Pointer to array of object IDs
220222
*/
221-
PYHELIOS_API unsigned int* getAllObjectIDs(helios_Context* context, unsigned int* size);
223+
PYHELIOS_API unsigned int* getAllObjectIDs(helios::Context* context, unsigned int* size);
222224

223225
/**
224226
* @brief Get primitive UUIDs for a specific object
@@ -227,7 +229,7 @@ PYHELIOS_API unsigned int* getAllObjectIDs(helios_Context* context, unsigned int
227229
* @param size Pointer to store the number of UUIDs
228230
* @return Pointer to array of UUIDs
229231
*/
230-
PYHELIOS_API unsigned int* getObjectPrimitiveUUIDs(helios_Context* context, unsigned int objectID, unsigned int* size);
232+
PYHELIOS_API unsigned int* getObjectPrimitiveUUIDs(helios::Context* context, unsigned int objectID, unsigned int* size);
231233

232234
//=============================================================================
233235
// Visualizer Functions
@@ -263,7 +265,7 @@ PYHELIOS_API void destroyVisualizer(Visualizer* visualizer);
263265
* @param visualizer Pointer to the Visualizer
264266
* @param context Pointer to the Context
265267
*/
266-
PYHELIOS_API void buildContextGeometry(Visualizer* visualizer, helios_Context* context);
268+
PYHELIOS_API void buildContextGeometry(Visualizer* visualizer, helios::Context* context);
267269

268270
/**
269271
* @brief Build specific Context geometry UUIDs in the visualizer
@@ -272,7 +274,7 @@ PYHELIOS_API void buildContextGeometry(Visualizer* visualizer, helios_Context* c
272274
* @param uuids Array of primitive UUIDs to visualize
273275
* @param uuid_count Number of UUIDs in the array
274276
*/
275-
PYHELIOS_API void buildContextGeometryUUIDs(Visualizer* visualizer, helios_Context* context, unsigned int* uuids, unsigned int uuid_count);
277+
PYHELIOS_API void buildContextGeometryUUIDs(Visualizer* visualizer, helios::Context* context, unsigned int* uuids, unsigned int uuid_count);
276278

277279
/**
278280
* @brief Open interactive visualization window
@@ -352,15 +354,15 @@ PYHELIOS_API bool validateTextureFile(const char* texture_file);
352354
* @param context Pointer to the Helios Context
353355
* @return Pointer to the created WeberPennTree
354356
*/
355-
PYHELIOS_API WeberPennTree* createWeberPennTree(helios_Context* context);
357+
PYHELIOS_API WeberPennTree* createWeberPennTree(helios::Context* context);
356358

357359
/**
358360
* @brief Create a WeberPennTree instance with build directory
359361
* @param context Pointer to the Helios Context
360362
* @param buildDirectory Path to the build directory
361363
* @return Pointer to the created WeberPennTree
362364
*/
363-
PYHELIOS_API WeberPennTree* createWeberPennTreeWithBuildPluginRootDirectory(helios_Context* context, const char* buildDirectory);
365+
PYHELIOS_API WeberPennTree* createWeberPennTreeWithBuildPluginRootDirectory(helios::Context* context, const char* buildDirectory);
364366

365367
/**
366368
* @brief Destroy a WeberPennTree instance

native/src/pyhelios_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// PyHelios C Interface
22
// Provides C-style functions for ctypes integration with Helios library
33

4-
#include "pyhelios_wrapper.h"
4+
#include "../include/pyhelios_wrapper.h"
55
#include "Context.h"
66
#ifdef VISUALIZER_PLUGIN_AVAILABLE
77
#include "Visualizer.h"

0 commit comments

Comments
 (0)