I have the following piece of code which I'm trying to understand. I know what this code does, but I don't get what each element mean. Can somebody please explain it to me?

typedef int(__stdcall * pICFUNC)(int, int);
pICFUNC add;
add = pICFUNC(lpfnGetProcessID);

Basically, this code allows me to prototype a function called add that takes two int parameters and returns an int too. The add function is within an external DLL file. But I want to understand each element.

The reason I ask is because the way the external DLL is coded defines the add function with __stdcall as well.

int __stdcall add(int x, int y);

But I want to remove the __stdcall part from my external DLL code. When I do that, and also remove the __stdcall from my typedef code as well, I get a bunch of errors which I don't understand.

5 Years
Discussion Span
Last Post by Ancient Dragon

You can not just arbitrarily remove __stdcall from the function prototypes because the DLL was compiled to use it. __stdcall is one of 5 calling conventions used by Microsoft (and probably others too) compilers. Here is a more in-depth thread about it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.