-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add parameter to dccl protoc plugin to allow generation of load file for processed protos #106
Conversation
…cpp suitable for generating a shared library that will automatically load all DCCL messages in that library when Codec::load_library is called
Thanks for this @tsaubergine! Certainly simplifies some things. However, there are 2 issues that I'm noticing. Issue 1I'm missing some Given the input files:
The generated
Manually checking both the CPP and Python output files generated by
One message that is persistently not generating a
Which is message 47 of 50 in the file (by ID and placement), so it's not EOF problems. Messages that build upon this message, for example:
Are compiling fine. If I rename Issue 2It is now difficult to identify non-compliant messages as the exception thrown does not state what descriptor it has a problem with. For example, in a Python development workflow, no further traceback is available beyond:
Suggested change is for all Exceptions to include the
|
…name was a subset of a message already loaded would be skipped
Thanks for your feedback, it's very helpful! Issue 1: Stupid bug on my part, fixed now (protoc-gen-dccl searches for the message loader to avoid adding it multiple times, but this would falsely pick up messages that were a substring of an existing message. Avoided by adding "<" and ">" to the search string to pick up the complete template)
where "Message: dccl.test.TestMsg" will be added whenever the descriptor is known. |
#106 introduced exposed unwanted behaviour in the DCCL CLI application. Calling dccl --dlopen /path/to/shared/library.so --analyze dumped the entire library contents to terminal, ignoring the --messages``` flag. This fixes that behaviour.
Fixed DCCL CLI ignoring --messages with --dlopen
@philboske Let me know if this works OK for you now and I'll merge it in (will be part of release 4.1.0) |
@tsaubergine Seems to be functioning correctly for us. Thanks again. |
Overview
The DCCL
protoc
plugin (protoc-gen-dccl
) now optionally accepts a parameterdccl3_load_file
that provides a path to the desired output of a.cpp
file which will include the required code to load and unload all DCCL messages compiled with this parameter using the existing C-functionsdccl3_load
anddccl3_unload
.If the file already exists
protoc-gen-dccl
will not regenerate it, but rather add any new loaders that are missing to the end of the file. This allows the option of this file being part of the (version-controlled) source code and other custom manual actions performed in thedccl3_load
anddccl3_unload
functions (such as FieldCodecManager add and remove functions).Closes #103
Usage
Set
protoc
to use the DCCL plugin (protoc-gen-dccl
) and add thedccl3_load_file
parameter to the endprotoc
can be run with multiple protos in a single call or multiple times with the samedccl3_load_file
and they will all be appended to thedccl3_load_file
given.At this point you can build a shared library (e.g.
libmy_protos.so
) as desired with the yourmy.pb.cc
anddccl_load.cpp
file and then you can load it with:Example Generated File
The
dccl3_load_file
that is generated by new unit testdccl_load_file
: