fmiFunctions_.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef FMIFUNCTIONS__H
  2. #define FMIFUNCTIONS__H
  3. /* Below section was moved here from fmiFunctions.c to be able to handle source code export correctly; for FMI 1.0,
  4. inclusion of this file from types.h is necessary, why the model identifier must be set already in this header file. */
  5. #ifndef BUILD_LIBFMI
  6. /* -- start inclusion of model identifier -- */
  7. #include "fmiModelIdentifier.h"
  8. /* pre-processor variable MODEL_IDENTIFIER was renamed to FMI2_FUNCTION_PREFIX for FMI 2.0 and also supposed to include the trailing '_' */
  9. #if !defined FMI2_FUNCTION_PREFIX && defined MODEL_IDENTIFIER
  10. #define _paste(a,b) a ## b
  11. #define _pasteB(a,b) _paste(a,b)
  12. #define FMI2_FUNCTION_PREFIX _pasteB(MODEL_IDENTIFIER,_)
  13. #endif
  14. /* -- end inclusion of model identifier -- */
  15. #endif /* BUILD_LIBFMI */
  16. #ifdef FMU_SOURCE_CODE_EXPORT
  17. #if !defined(FMI_2) && !defined(FMU_CO_SIM)
  18. #include "fmiModelFunctions.h"
  19. typedef fmiCallbackFunctions fmiMECallbackFunctions;
  20. #define fmiPlatform fmiModelTypesPlatform
  21. #else
  22. #if defined(FMI_2)
  23. #include "fmi2Functions.h"
  24. #else
  25. #include "fmiFunctions.h"
  26. typedef fmiCallbackFunctions fmiCoSimCallbackFunctions;
  27. /* For source co-simulation code export we must provide the type definition from model exchange here to enable code-reuse later . */
  28. typedef struct {
  29. fmiCallbackLogger logger;
  30. fmiCallbackAllocateMemory allocateMemory;
  31. fmiCallbackFreeMemory freeMemory;
  32. } fmiMECallbackFunctions;
  33. #endif
  34. #endif /* !defined(FMI_2) && !defined(FMU_CO_SIM) */
  35. #else /* FMU_SOURCE_CODE_EXPORT */
  36. #ifdef FMI_2
  37. #include "fmi2Functions.h"
  38. #else
  39. #include "fmiFunctions_1.0.h"
  40. #endif /* FMI_2 */
  41. #endif /* FMU_SOURCE_CODE_EXPORT */
  42. #endif /* FMIFUNCTIONS__H */