Search code examples
c++cfunction-signature

Wrap many C calling functions to single implementation


``I have a requirement that the function call will have different names but all of them should refer to the same definition while executing. For example, i have a function calls like

UINT8 vsignal;UINT8 vsignal1;void Read_Message1_Signal1(&vSignal);void Read_Message2_Signal2(&vSignal1);

but this should be linked to

void Read_Message_Signal(UINT8 *signal){}

which is already implemented and compiled as a dll and should be linked to the different calls as those calls may vary based on the input.

Can anyone help me how to achieve this requirement?


Solution

  • Is there some reason you can't just write your own wrapper?

    void Read_Message1_Signal1(&vSignal)
    {
        Read_Message_Signal(vSignal);
    }
    
    void Read_Message2_Signal2(&vSignal)
    {
        Read_Message_Signal(vSignal);
    }
    

    You can autogenerate these with a macro if there are a lot of them.