Skip to content

Commit fce1cb4

Browse files
committed
force c-linkage for private_selfttest function
When building on windows with visual studio, source files are compiled using the c++-compiler. So all exported symbols need to be enclosed by an extern "C" {} to force c-linkage (which almost all exported symbols do already). However the private_selftest function, which gets exported in project_library.h (i.e. czmq_library.h) when building in draft mode, is missing an extetn "C". This commit encloses the private_selftest function declaration in an extern "C" block to also force c-linkage for that symbol.
1 parent 941ed6c commit fce1cb4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

zproject_class.gsl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,18 @@ typedef struct _$(class.c_name:)_t $(class.c_name:)_t;
172172
.endfor
173173

174174
#ifdef $(PROJECT.PREFIX)_BUILD_DRAFT_API
175+
176+
#ifdef __cplusplus
177+
extern "C" {
178+
#endif
179+
175180
// Self test for private classes
176181
$(PROJECT.PREFIX)_EXPORT void
177182
$(project.prefix)_private_selftest (bool verbose, const char *subtest);
183+
184+
#ifdef __cplusplus
185+
}
186+
#endif
178187
#endif // $(PROJECT.PREFIX)_BUILD_DRAFT_API
179188

180189
#endif

0 commit comments

Comments
 (0)