MPC_AddToScenario() Error: Too Many Arguments

Updated Aug 14, 2020

Reported In

Hardware

  • Micropross Accessories

Other

HW: MP500 TCL3 or MP500 PT1
SW: MPuLib

Issue Details

The MPuLib function MPC_AddToScenarioPcd( ) is reporting the following error message: ValueError: Procedure probably called with too many arguments (20 bytes in excess). I am not seeing this error when using a 64-bit operating system, but it always appears when I use a 32-bit OS. 

Why am I receiving this error?

Solution

MPC_AddToScenarioPCD( ) is a variadic function, which means it accepts a variable number of arguments.

On a 32-bit Windows architecture, MPuLib will use the stdcall calling convention, except on variadic functions, in which case it uses the cdecl calling convention. As a result, test developers using MPuLib on 32-bit architectures are required to declare 2 different DLL objects (WinDLL and CDLL) and use the CDLL object for calls to variadic functions. 

This does not apply to other architectures.

Additional Information

The following example which is written in Python using the ctypes library illustrates the usage of multiple DLL objects.