Skip to content

Commit

Permalink
- fix +target=msvc (include omc_alloc_* in extern "C")
Browse files Browse the repository at this point in the history
- add clean target in the makefile for Visual Studio


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17851 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 23, 2013
1 parent ea039bd commit 4c298a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -3720,6 +3720,9 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula

$(FILEPREFIX)$(EXEEXT): $(MAINFILE) $(FILEPREFIX)_functions.h $(CFILES)
<%\t%>$(CXX) /Fe$(FILEPREFIX)$(EXEEXT) $(MAINFILE) $(CFILES) $(CFLAGS) $(LDFLAGS)

clean:
<%\t%>rm -f *.obj *.lib *.exp *.c *.h *.xml *.libs *.log *.makefile *.pdb *.idb *.exe
>>
end match
case "gcc" then
Expand Down
8 changes: 4 additions & 4 deletions SimulationRuntime/c/openmodelica.h
Expand Up @@ -257,10 +257,6 @@ typedef struct threadData_s {
#define homotopy(actual, simplified) (actual)
#define homotopyParameter() data->simulationInfo.lambda

#if defined(__cplusplus)
}
#endif

typedef struct {
void (*init)(void);
void* (*malloc)(size_t);
Expand All @@ -273,4 +269,8 @@ typedef struct {
extern omc_alloc_interface_t omc_alloc_interface;
extern omc_alloc_interface_t omc_alloc_interface_pooled;

#if defined(__cplusplus)
} /* end extern "C" */
#endif

#endif
10 changes: 10 additions & 0 deletions SimulationRuntime/c/util/memory_pool.c
Expand Up @@ -35,6 +35,10 @@
#include <pthread.h>
#include <gc.h>

#if defined(__cplusplus)
extern "C" {
#endif

omc_alloc_interface_t omc_alloc_interface = {
GC_init,
GC_malloc,
Expand Down Expand Up @@ -170,3 +174,9 @@ void* generic_alloc(int n, size_t sze)
{
return (void*) omc_alloc_interface.malloc(n*sze);
}


#if defined(__cplusplus)
} /* end extern "C" */
#endif

8 changes: 8 additions & 0 deletions SimulationRuntime/c/util/memory_pool.h
Expand Up @@ -35,6 +35,10 @@
#include <stdlib.h>
#include "openmodelica.h"

#if defined(__cplusplus)
extern "C" {
#endif

/* Allocation functions */
extern m_real* real_alloc(int n);
extern m_integer* integer_alloc(int n);
Expand All @@ -45,4 +49,8 @@ extern _index_t** index_alloc(int n);

void* generic_alloc(int n, size_t sze);

#if defined(__cplusplus)
} /* end extern "C" */
#endif

#endif

0 comments on commit 4c298a0

Please sign in to comment.