Opened 9 years ago

Last modified 9 years ago

#3289 assigned defect

FMU compilation (MSVC) fails for big models

Reported by: michael.kobierski@… Owned by: adrpo
Priority: high Milestone: Future
Component: FMI Version: trunk
Keywords: Cc:

Description

Using flag +target=msvc, the following is observed when creating an FMU from a model with a very long modelDescription.xml file (the contents of which are also stored in a .c file).

mymodel_init.c(1) : error C2026: string too big, trailing characters truncated
mymodel_info.c(1) : error C2026: string too big, trailing characters truncated

The same code will compile fine with gcc, due to the compiler specific nature of limits imposed on string literals. Turns out cl has a maximum limit of 16KB.

Change History (5)

comment:1 Changed 9 years ago by anonymous

Hello, has any progress been made on this item since it was posted?

comment:2 Changed 9 years ago by adrpo

  • Owner changed from adeas31 to adrpo
  • Status changed from new to assigned

If you define OPENMODELICA_XML_FROM_FILE_AT_RUNTIME when compiling the C file then the _init.c and _info.c files are not included but are read at runtime.
However, depending on how the fmu is expanded by the tool that loads it the dll might not find these files. That's why we included them.

I guess for MSVC we would need to use something like xxd (we used that before) to encode the xml files for C inclusion. I'll give it a try.

comment:3 Changed 9 years ago by adrpo

Hm, the MSDN says "The maximum length of a string literal is 65535 bytes".
I wonder if this means we can do something like:

x = "max_string1" "max_string2" "max_string3";

I'll give it a try.

comment:4 Changed 9 years ago by michael.kobierski@…

Hello, can I inquire what the latest news is for this ticket?

comment:5 Changed 9 years ago by adrpo

I've been trying various ways to fix this but I haven't got any success yet.
Have you tried with the C++ runtime using flags: +target=msvc +simCodeTarget=Cpp

Version 0, edited 9 years ago by adrpo (next)
Note: See TracTickets for help on using tickets.