I have function which I have created a DLL for. I'm trying to call this function from a C++ program using some code I found online. I know the code works fine when the function in the DLL uses the convention call __stdcall , however, I don't want to use this calling convention because I don't want to modify my DLL functions.

The part in the C++ application which allows me to prototype the function is as follows:

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

The question is, can I use this function without having to prototype it with __stdcall ?

Sure. The important thing is that you make sure that both have the same calling convention. If your DLL function was compiled with another calling convention, then that's the calling convention that you should have for your function-pointer type "pICFUNC". BTW, the default calling convention in C/C++ is "__cdecl" on most compilers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.