Version: v3.7.0 (v3.6.1 shows same behavior for me)
Language: C++
MacOS Mojave 10.14.2
XCode 10.1 (tried all compiler options, C++11..17, Gnu11..17, same problem)
Steps to reproduce the behavior:
- Starting with trivial api.proto:
syntax = "proto3";
message RegisterRequest {
string device_id = 1;
string device_type = 2;
}
- Trivial main.cpp:
#include "api.pb.h"
#include <iostream>
int main(int argc, const char * argv[])
{
RegisterRequest* Request = new RegisterRequest();
Request->set_device_type("123");
Request->set_device_id("456789");
std::cout << "DeviceType:" << Request->device_type() << ", DeviceID:" << Request->device_id() << "\n";
return 0;
}
- After compiling and linking against libprotobuf.a, I see same text for both string fields:
DeviceType:456789, DeviceID:456789
Adding more string fields to message reproduces the pattern, all string ptrs seem to point to the same char buffer.
My impression is that all setter-methods (tried every kind, including mutable and set_allocated) just modify the same static "default-value buffer" instead of allocating new values for each field.
Maybe I miss some preprocessor definitions necessary for MacOS?
(Win libraries work fine; I even managed to do Android/iOS builds without major problems; but currently out of clues for this MacOS behavior).
Please advise :)
Version: v3.7.0 (v3.6.1 shows same behavior for me)
Language: C++
MacOS Mojave 10.14.2
XCode 10.1 (tried all compiler options, C++11..17, Gnu11..17, same problem)
Steps to reproduce the behavior:
Adding more string fields to message reproduces the pattern, all string ptrs seem to point to the same char buffer.
My impression is that all setter-methods (tried every kind, including mutable and set_allocated) just modify the same static "default-value buffer" instead of allocating new values for each field.
Maybe I miss some preprocessor definitions necessary for MacOS?
(Win libraries work fine; I even managed to do Android/iOS builds without major problems; but currently out of clues for this MacOS behavior).
Please advise :)