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
Using a pb_bytes_array_t of max size > 256 #510
Comments
Hmm, that's certainly a bug. With 0.4.x, it should really work up to 65535 without anything special. As a workaround, try adding this line into your .options:
|
Ah, now that I look more closely, the error appears to come from some "Wrapper" message. Try applying the The issue is probably that the generator cannot find the |
Hey @PetteriAimonen. Thanks for the super quick reply. Let me give a little more explanation about the setup. Because the messages are nested. I have a wrapper:
This message contains an IO message and an IO message can contain a CameraCapture like such:
I don't think it's because of finding the I have now set the options file to:
And it is still giving me the same error. Any idea on what I'm doing wrong? |
Actually, it will give me the error starting from a max_size > 206, not > 265 (seems a pretty random number to me, but perhaps it helps) |
Try:
in the .options file for the wrapper message. The problem is that the CameraCapture submessage inside Wrapper is growing beyond 256 bytes, but for some reason the generator doesn't notice it when generating the Wrapper message. Your compile errors all refer to the Wrapper message. |
Ok. I did that.
Still getting these errors
|
For some reason the option doesn't appear to have applied, did you regenerate |
Ah no! Apologies, I changed the compile command to generate the c file to an empty folder when adding the options file. I corrected it, and it has generated a correct C file and I'm not getting the error anymore. Thanks so much! Do I need to add this option to every proto file that uses large byte arrays or just the wrapper? And do I still need to keep the define in pb.h? |
The Normally the generator should automatically detect the need, and that seems to be working correctly inside It may work directly without any options if you generate all your .proto files in one step, e.g:
That makes sure the generator has all necessary files available. |
yeah, I feel like I'm doing that in a suboptimal way now. I made a .bat file that generated the output like so:
Is there a way to generate all the proto files in 1 go ensuring that they use their options file? I couldn't manage to have the compiler find the correct option files without specifying them myself. |
It is annoying indeed. Protoc doesn't pass the You could try this: |
great! Well that's an optimization. Thanks for all the help. |
Hi everyone!
I have defined a simple message that will contain a byte array with a Camera Capture.
I want to statically assign a max size in the options file of 4096 bytes. We have a buffer available that can manage that type of statically allocated size. However when I compile the generated c code. I get errors saying
I thought that defining PB_FIELD_32_BIT in pb.h would be enough to support large byte arrays. The website mentions this for the PB_FIELD_32_BIT field: Add support for tag numbers > 65535 and fields larger than 65535 bytes or 65535 array entries. Increases code size 9 bytes per each field. Compiler error will tell if you need this.
I defined it in the pb.h field and did not change anything else, like such:
Do I need to add the flag as well in the compiler command? Am I misinterpreting the use of this define? Is there any other way to work with a byte array of max 4096 bytes?
Thanks in advance!
Imara
The text was updated successfully, but these errors were encountered: