I have a question and would like to ask everyone, can P4 language call C language? How to call it?
There is no standard way defined for P4 to be able to call C.
Some targets that support C as a programming language, in particular targets running on general purpose CPUs like BMv2, EBPF, DPDK, etc. might choose to define a target-specific way for the P4 code to call into C. To find out, you would need to examine the detailed capabilities of each target that supports programming in C.
I do not have a summarized list of which target support this, and which do not. Sorry. Perhaps someone else reading this may know, for one or more targets, and answer.
1 Like