-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marshaling of structs that include repeated fields #2524
Conversation
… and become even more messy if we want to generate marshalers. We'll do null termination everywhere. Change repeated fields to be pointers to pointers on the C++ side.
Marshal.WriteIntPtr(native, | ||
i * sizeof_intptr, | ||
t_marshaler_instance_. | ||
MarshalManagedToNative(value[i])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that the resulting IntPtr is not null.
serialization/journal.proto
Outdated
required fixed64 deserializer = 2 | ||
[(pointer_to) = "PushDeserializer", | ||
(is_consumed_if) = "serialization->empty()"]; | ||
(is_consumed_if) = "*serialization == '\\0'"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string_view(serialization).empty()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We might want to change the API so that termination is signalled by serialization == nullptr
but that is a job for another pull request.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but note how this is less efficient (not that we care, I think it's only used when playing a journal).
RepeatedMarshaler
, which is a helper referenced by the generated code that marshals aT[]
into an array ofIntPtr
, seen on the C++ side as aT**
.(size)
field from the generator. We'll use null termination everywhere. The(size)
field was the source of a lot of complexity in the generator, and it becomes unmanageable with custom marshalers. While that removal simplifies the generator quite a bit, it changes many parts of it.InBodyParametersMarshaler
, it's now replaced by generated code.°
for angles.As usual, there are separate commit for the generated code before/after the changes.