Closed javierhonduco closed 4 years ago
cc @rdelfin In case you have any feedback!
Thanks for opening this! Seems like a good feature to add.
I'd rather see this implemented using the builder pattern instead of adding a dedicated function to create w/ CFLAGs. This will give us more flexibility going forward and addresses the concern you had around adding more args in the future.
I'll see if I can take this on.
@javierhonduco - can you see if the version in master since #128 landed meets your current needs?
Sorry for the delay, just came from holidays :)
I'd rather see this implemented using the builder pattern instead of adding a dedicated function to create w/ CFLAGs. This will give us more flexibility going forward and addresses the concern you had around adding more args in the future.
Totally, this is way better! Just left some comments in #128! :)
This PR adds support for passing a vector of cflags that will be passed to the bcc backend and processed by clang's preprocessor
Template
The BCC Python and C++ bindings allow passing CFLAGS to the BPF program. We are using this feature in a project with a Python BCC driver and are currently experimenting with Rust so we would love to be able to use it :smile:
Moves
bpf_module_create_c_from_string
to its own function, leavingnew
with the same signature, and addsnew_with_cflags
, to which you can pass CFLAGS has a second argumentIt should not break backwards compatibility. I am a not experienced with Rust (first Rust PR!), so I am unsure if there is a better way to do this!
Test plan
Added a simple smoke test
Thanks!