Please post the exact error message given by the compiler.
Note that the default calling convention for C/C++ functions is __cdecl, you probably want to define foo as
int __stdcall foo(LPSTR bla)
that is the requirement for the pointers declared as WINAPI.
Note also that if you're in a class then foo should be static and declared as __stdcall, because in classes the defualt calling convention is __thiscall.
Or, as the other users said above,
int WINAPI foo (LPSTR bla)
afer all WINAPI is just a define for __stdcall