Skip to content

Commit bceaafe

Browse files
committed
- fix the opc_ua build on msvc
1 parent 6b6f863 commit bceaafe

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

SimulationRuntime/c/util/omc_msvc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,15 @@ void* omc_dlopen(const char *filename, int flag)
227227
static const char* GetLastErrorAsString()
228228
{
229229
static char *str = NULL;
230+
LPSTR messageBuffer = NULL;
231+
size_t size = 0;
230232
//Get the error message, if any.
231233
DWORD errorMessageID = GetLastError();
232234
if (errorMessageID == 0) {
233235
return ""; //No error message has been recorded
234236
}
235237

236-
LPSTR messageBuffer = NULL;
237-
size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
238+
size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
238239
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
239240

240241
if (str != NULL) {

SimulationRuntime/c/util/omc_msvc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ void* omc_dlopen(const char *filename, int flag);
125125
char* omc_dlerror();
126126
void* omc_dlsym(void *handle, const char *symbol);
127127
int omc_dlclose(void *handle);
128-
static inline void* dlopen(const char *filename, int flag) {
128+
static OMC_INLINE void* dlopen(const char *filename, int flag) {
129129
return omc_dlopen(filename, flag);
130130
}
131-
static inline char* dlerror() {
131+
static OMC_INLINE char* dlerror() {
132132
return omc_dlerror();
133133
}
134-
static inline void* dlsym(void *handle, const char *symbol) {
134+
static OMC_INLINE void* dlsym(void *handle, const char *symbol) {
135135
return omc_dlsym(handle, symbol);
136136
}
137-
static inline int dlclose(void *handle) {
137+
static OMC_INLINE int dlclose(void *handle) {
138138
return omc_dlclose(handle);
139139
}
140140
#endif

0 commit comments

Comments
 (0)