the problem is, FPC does NOT allow vararg functions/procedures. Vararg can only be used to declare an _external_ function (usually written in C or C++).
However, FPC provides an elegant, simple and type-safe solution to the problem.
The function you've shown takes a variable number of parameters... no problem! in the DLL define _multiple_ functions for the different types and number of parameters. You'd have something along these lines:
SendDeviceMessage_1P(UINT msgid, Parameter: ParameterType); begin <code> end;
SendDeviceMessage_2P(UINT msgid, P1 : P1type; P2: P2type); begin end;
and so on for every possibility (which in your case is determined by the enumeration in the switch.
In the unit that declares the dll functions (to make them available to the external program) you use FPC's function overloading. You simply declare every function with the same name, i.e, SendDeviceMessage and specifying external <yourdllname>; name "SendDeviceMessage_xP" where x is the name that matches the number of parameters in the declaration.
that way, you can have a single function name along with a variable number of parameters of different types and, all that with the Pascal bonus that the compiler can do type checking, which neither C nor C++ can type check because "..." may be anything. Long live Pascal