Re: using a DLL function in a header file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



AK wrote:
I don't understand why the compiler understands the creation of ProcAdd2, yet complains about it's use in the header file ??

You've put the declaration in the .cpp file, but use the type/variable from the .h file. It should be the other way around. Just put these in the header file:


typedef void (_stdcall *MyOut32)(short,short);
typedef short (_stdcall *MyInp32)(short);

// private data members:
MyInp32 ProcAdd1;
MyOut32 ProcAdd2;

The declaration must go before the usage.

Tom
.