Skip to content

Commit 8c805ea

Browse files
committed
refs modelica#4576: Apply name mangling to avoid MSVC duplicated symbols issue
1 parent 4e30696 commit 8c805ea

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

Modelica/Resources/C-Sources/ModelicaInternal.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -776,14 +776,14 @@ static FileCache* fileCache = NULL;
776776
#include <pthread.h>
777777
#if defined(G_HAS_CONSTRUCTORS)
778778
static pthread_mutex_t m;
779-
G_DEFINE_CONSTRUCTOR(initializeMutex)
780-
static void initializeMutex(void) {
779+
G_DEFINE_CONSTRUCTOR(G_FUNCNAME(initializeMutex))
780+
static void G_FUNCNAME(initializeMutex)(void) {
781781
if (pthread_mutex_init(&m, NULL) != 0) {
782782
ModelicaError("Initialization of mutex failed\n");
783783
}
784784
}
785-
G_DEFINE_DESTRUCTOR(destroyMutex)
786-
static void destroyMutex(void) {
785+
G_DEFINE_DESTRUCTOR(G_FUNCNAME(destroyMutex))
786+
static void G_FUNCNAME(destroyMutex)(void) {
787787
if (pthread_mutex_destroy(&m) != 0) {
788788
ModelicaError("Destruction of mutex failed\n");
789789
}
@@ -800,17 +800,17 @@ static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
800800
#include <windows.h>
801801
static CRITICAL_SECTION cs;
802802
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
803-
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(ModelicaInternal_initializeCS)
803+
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaInternal_initializeCS))
804804
#endif
805-
G_DEFINE_CONSTRUCTOR(ModelicaInternal_initializeCS)
806-
static void ModelicaInternal_initializeCS(void) {
805+
G_DEFINE_CONSTRUCTOR(G_FUNCNAME(ModelicaInternal_initializeCS))
806+
static void G_FUNCNAME(ModelicaInternal_initializeCS)(void) {
807807
InitializeCriticalSection(&cs);
808808
}
809809
#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
810-
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(ModelicaInternal_deleteCS)
810+
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaInternal_deleteCS))
811811
#endif
812-
G_DEFINE_DESTRUCTOR(ModelicaInternal_deleteCS)
813-
static void ModelicaInternal_deleteCS(void) {
812+
G_DEFINE_DESTRUCTOR(G_FUNCNAME(ModelicaInternal_deleteCS))
813+
static void G_FUNCNAME(ModelicaInternal_deleteCS)(void) {
814814
DeleteCriticalSection(&cs);
815815
}
816816
#define MUTEX_LOCK() EnterCriticalSection(&cs)

Modelica/Resources/C-Sources/ModelicaRandom.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
7575
#include <windows.h>
7676
static CRITICAL_SECTION cs;
7777
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
78-
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(ModelicaRandom_initializeCS)
78+
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaRandom_initializeCS))
7979
#endif
80-
G_DEFINE_CONSTRUCTOR(ModelicaRandom_initializeCS)
81-
static void ModelicaRandom_initializeCS(void) {
80+
G_DEFINE_CONSTRUCTOR(G_FUNCNAME(ModelicaRandom_initializeCS))
81+
static void G_FUNCNAME(ModelicaRandom_initializeCS)(void) {
8282
InitializeCriticalSection(&cs);
8383
}
8484
#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
85-
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(ModelicaRandom_deleteCS)
85+
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaRandom_deleteCS))
8686
#endif
87-
G_DEFINE_DESTRUCTOR(ModelicaRandom_deleteCS)
88-
static void ModelicaRandom_deleteCS(void) {
87+
G_DEFINE_DESTRUCTOR(G_FUNCNAME(ModelicaRandom_deleteCS))
88+
static void G_FUNCNAME(ModelicaRandom_deleteCS)(void) {
8989
DeleteCriticalSection(&cs);
9090
}
9191
#define MUTEX_LOCK() EnterCriticalSection(&cs)

Modelica/Resources/C-Sources/ModelicaStandardTables.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ static TableShare* tableShare = NULL;
435435
#include <pthread.h>
436436
#if defined(G_HAS_CONSTRUCTORS)
437437
static pthread_mutex_t m;
438-
G_DEFINE_CONSTRUCTOR(initializeMutex)
439-
static void initializeMutex(void) {
438+
G_DEFINE_CONSTRUCTOR(G_FUNCNAME(initializeMutex))
439+
static void G_FUNCNAME(initializeMutex)(void) {
440440
if (pthread_mutex_init(&m, NULL) != 0) {
441441
ModelicaError("Initialization of mutex failed\n");
442442
}
443443
}
444-
G_DEFINE_DESTRUCTOR(destroyMutex)
445-
static void destroyMutex(void) {
444+
G_DEFINE_DESTRUCTOR(G_FUNCNAME(destroyMutex))
445+
static void G_FUNCNAME(destroyMutex)(void) {
446446
if (pthread_mutex_destroy(&m) != 0) {
447447
ModelicaError("Destruction of mutex failed\n");
448448
}
@@ -459,17 +459,17 @@ static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
459459
#include <windows.h>
460460
static CRITICAL_SECTION cs;
461461
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
462-
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(ModelicaStandardTables_initializeCS)
462+
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaStandardTables_initializeCS))
463463
#endif
464-
G_DEFINE_CONSTRUCTOR(ModelicaStandardTables_initializeCS)
465-
static void ModelicaStandardTables_initializeCS(void) {
464+
G_DEFINE_CONSTRUCTOR(G_FUNCNAME(ModelicaStandardTables_initializeCS))
465+
static void G_FUNCNAME(ModelicaStandardTables_initializeCS)(void) {
466466
InitializeCriticalSection(&cs);
467467
}
468468
#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
469-
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(ModelicaStandardTables_deleteCS)
469+
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(G_FUNCNAME(ModelicaStandardTables_deleteCS))
470470
#endif
471-
G_DEFINE_DESTRUCTOR(ModelicaStandardTables_deleteCS)
472-
static void ModelicaStandardTables_deleteCS(void) {
471+
G_DEFINE_DESTRUCTOR(G_FUNCNAME(ModelicaStandardTables_deleteCS))
472+
static void G_FUNCNAME(ModelicaStandardTables_deleteCS)(void) {
473473
DeleteCriticalSection(&cs);
474474
}
475475
#define MUTEX_LOCK() EnterCriticalSection(&cs)

0 commit comments

Comments
 (0)