gencpp icon indicating copy to clipboard operation
gencpp copied to clipboard

windows compilation issue when building huge msg

Open muratory opened this issue 4 years ago • 1 comments

when using custom message with big structure, we may reach the windows compilator limit of 65535 character for a string.

This happens in msg creation when building the comment string in escape_message_definition function.

proposed patch is to break when 64000 size limit is reached 👍 def escape_message_definition(definition): lines = definition.splitlines() if not lines: lines.append('') s = StringIO() count = 0 for line in lines: line = _escape_string(line) # individual string literals cannot be too long; need to utilize string concatenation for long strings # https://docs.microsoft.com/en-us/cpp/c-language/maximum-string-length?view=vs-2017 s.write('"%s\n"\n' % (line)) #patch to exit when line total greater than 64000 due to windows compil limitation count = count + len(line) + 6 if count > 64000: break val = s.getvalue() s.close() return val

muratory avatar Sep 02 '20 10:09 muratory

Please consider to create a pull request with your proposed patch.

dirk-thomas avatar Sep 02 '20 16:09 dirk-thomas