behavioral-model icon indicating copy to clipboard operation
behavioral-model copied to clipboard

Why bmi_port.c is a C code?

Open at-nojavan opened this issue 9 months ago • 2 comments

Hello everyone!

I'm trying to make a backward-compatible edit to the BMv2 simple switch. Simple switch passes a packet handler from the place that static void packet_handler(int port_num, const char *buffer, int len, void *cookie) function is defined here, all the way to the place it's used in the bmi_port.c.

I see that in the dev_mgr_bmi.cpp here, a transform is performed on the handler from std::function to C style function pointer, because the next code in the chain is a C code (bmi_port.c). I am trying to pass a std::function that has capture and this transform is causing some issues for me. Now I have a question. Why bmi_port.c is a C code and not C++. What is the restriction that binds us to use C code? Is it possible to change this to C++?

at-nojavan avatar May 18 '24 04:05 at-nojavan