Made manual driver registration only ever happen once
@@ -86,7 +86,8 @@ void survive_verify_FLT_size(uint32_t user_size) {
if (sizeof(FLT) != user_size) {
fprintf(stderr, "FLT type incompatible; the shared library libsurvive has FLT size %lu vs user program %u\n",
(unsigned long)sizeof(FLT), user_size);
- fprintf(stderr, "Add '#define FLT %s' before including survive.h or recompile the shared library with the "
+ fprintf(stderr,
+ "Add '#define FLT %s' before including survive.h or recompile the shared library with the "
"appropriate flag. \n",
sizeof(FLT) == sizeof(double) ? "double" : "float");
exit(-1);
@@ -103,6 +104,8 @@ SurviveContext *survive_init_internal(int argc, char *const *argv) {
#ifdef MANUAL_REGISTRATION
// note: this manual registration is currently only in use on builds using Visual Studio.
+ static int did_manual_driver_registration = 0;
+ if (did_manual_driver_registration == 0) {
#define MANUAL_DRIVER_REGISTRATION(func) \
int func(SurviveObject *so, PoserData *pd); \
RegisterDriver(#func, &func);
@@ -119,6 +122,8 @@ SurviveContext *survive_init_internal(int argc, char *const *argv) {
MANUAL_DRIVER_REGISTRATION(DisambiguatorCharles)
MANUAL_DRIVER_REGISTRATION(DisambiguatorStateBased)
MANUAL_DRIVER_REGISTRATION(DisambiguatorTurvey)
+ did_manual_driver_registration = 1;
+ }
#endif
SurviveContext *ctx = calloc(1, sizeof(SurviveContext));
