mbeddr / mbeddr.core

The mbeddr core. An extensible C
Eclipse Public License 2.0
225 stars 77 forks source link

Wrong translation of string-typed parameters in interface operations #677

Closed stephaneberle9 closed 11 years ago

stephaneberle9 commented 11 years ago

Scenario:

exported cs interface ISomething { void print(const string msg) }

exported component SomethingImpl extends nothing { provides ISomething something

void something_print(const string msg) <= op something.print { ... } }

Expected translation of const string parameter type: const char*

Actual translation of const string parameter type: int8_t*

Impact: gcc compile error: invalid conversion from 'const char_' to 'int8t {aka signed char*}' [-fpermissive]

stephaneberle9 commented 11 years ago

Important hint: This problems happens only when g++ instead of gcc is selected as complier in the build configuration.

stephaneberle9 commented 11 years ago

Thanks do Dominik's help, it has turned out that the problem goes away when the type size config that is in the same model as the build config is changed from

char -> int8 (is available true)

to

char -> char (is available true)

But anyway, my feeling is that string should ALWAYS translate to char* independent of what has been specified in the type size config.

stephaneberle9 commented 11 years ago

Two more problems that are also related this issue: a) When using the "Implement all operation" intention to implement an interface operation that has a const string parameter, the corresponding parameter in the component runnable is just string, i.e., the const is missing b) There is no const at all in the generated C code, i.e., neither in the function pointer declaration resulting from the interface nor in the function prototype declaration for the component runnable

bkolb commented 11 years ago

this has been fixed a while ago. we now always transform string to char*