Skip to content

Commit

Permalink
- properly fix alarm stuff (use extern "C" when cpp is defined!)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20852 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed May 27, 2014
1 parent f037d18 commit 2222b7d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 9 additions & 0 deletions SimulationRuntime/c/util/omc_msvc.c
Expand Up @@ -28,11 +28,16 @@
*
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "omc_msvc.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>


#if defined(__MINGW32__) || defined(_MSC_VER)
#include <windows.h>
#include <time.h>
Expand Down Expand Up @@ -98,3 +103,7 @@ unsigned int alarm (unsigned int seconds)
}

#endif

#ifdef __cplusplus
}
#endif
13 changes: 9 additions & 4 deletions SimulationRuntime/c/util/omc_msvc.h
Expand Up @@ -30,6 +30,10 @@
#ifndef __OPENMODELICA_MSVC_H
#define __OPENMODELICA_MSVC_H

#ifdef __cplusplus
extern "C" {
#endif

#include <math.h> /* Make sure we try to get INFINITY and NAN from the system. They are way cooler */

union MSVC_FLOAT_HACK
Expand Down Expand Up @@ -78,10 +82,6 @@ unsigned int alarm (unsigned int seconds);

#else /* not msvc */

#if defined(__MINGW32__)
unsigned int alarm (unsigned int seconds);
#endif

/* define inline for non-MSVC */
#define OMC_INLINE inline

Expand All @@ -92,11 +92,16 @@ unsigned int alarm (unsigned int seconds);
char *realpath(const char *path, char *resolved_path);
int asprintf(char **strp, const char *fmt, ...);
int vasprintf(char **strp, const char *fmt, va_list ap);
unsigned int alarm (unsigned int seconds);
#endif

/* for non GNU compilers */
#ifndef __GNUC__
#define __attribute__(x)
#endif

#ifdef __cplusplus
}
#endif

#endif

0 comments on commit 2222b7d

Please sign in to comment.