Reputation: 425
It just confused me:
typedef bool(*pGetNameByPid)(DWORD PID, TCHAR lpszProcessName[MAX_PATH]);
Is there anything with the sentence above? I want to export an function named GetNameByPid
from an DLL written in C++. But the compile reports that:
error C2143: syntax error : missing ')' before '*'
Any help?
Upvotes: 0
Views: 84
Reputation: 122001
There is no bool
type in C89, which is the C standard that the Microsoft Compilers support. You could use an int
or WINAPI's BOOL
as the return type:
typedef BOOL (*pGetNameByPid)(DWORD PID, TCHAR lpszProcessName[MAX_PATH]);
To export a function from DLL:
__declspec(dllexport) BOOL GetNameByPid(DWORD PID, TCHAR* lpszProcessName)
{
/* Do some work */
return TRUE;
}
Upvotes: 2