Declaration of external subprogram is not legal inside a class

You tried to use a Declare statement inside a class definition to declare an external C function. This is not allowed.

Move the declaration of the external function to the module level.