Opened 4 years ago
Last modified 3 years ago
#6098 accepted defect
(possibly) wrong type mapping for bool in record passed to external object
Reported by: | Owned by: | Mahder Alemseged Gebremedhin | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.19.0 |
Component: | Code Generation | Version: | |
Keywords: | Cc: |
Description
Summary:
A boolean in a record, passed to a external object will result in a wrong C struct for the record. Boolean will be translated to "signed char" instead of "int".
See https://modelica.org/documents/ModelicaSpec34.pdf#page=169
Given a record
record MyRecord
Real MyReal;
Boolean MyBoolean;
end MyRecord;
that will be passed to a function:
function bmaxxAufladung "Aufladung"
output MyRecord mRecord;
external "C" externalCFunction(mRecord);
end bmaxxAufladung;
will result in "MyModelName_functions.h"
typedef struct {
modelica_real _MyReal;
modelica_boolean _MyReal;
} ModelName_MyRecord;
modelica_boolean is defined as "typedef signed char modelica_boolean;" in include/omc/c/openmodelica_types.h
Change History (5)
comment:1 by , 4 years ago
Component: | *unknown* → Code Generation |
---|---|
Milestone: | Future → 1.17.0 |
Owner: | changed from | to
Priority: | high → blocker |
Status: | new → assigned |
comment:2 by , 4 years ago
Status: | assigned → accepted |
---|
@mahge390 this should be an easy fix