Members which are pointers to C functions
Jun 18, 2010 at 11:41am Jun 18, 2010 at 11:41am UTC
Hi,
I'm defining a DLL interface and have thought to define a class encapsulating the access to a certain DLLs.
This class will load the DLL and access several functions inside it. As all DLL will have the same set of functions, this should be quite straightforward.
All I need is to define a member inside the DLL wrapper class to be a pointer to the DLL function I want to execute. So I do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class CMyDLLWrapper
{
private :
/* blah, blah, blah */
typedef bool (__cdecl *tInitFunctionP)(void );
/* blah, blah, blah */
tInitFunctionP MyInitFunction;
public :
bool init(void ) { return MyInitFunction(); }
};
Well, this does not compile:
error C3646: 'tInitFunctionP' : unknown override specifier
error C3646: 'InitDLL' : unknown override specifier
I have used successfully this syntax in the main function, but when I port it inside the class I get those errors.
Any ideas?
thx
Jun 18, 2010 at 11:55am Jun 18, 2010 at 11:55am UTC
It seems this error depends on the line that comes before the reported one. Check your semicolons, or post the omitted sections.
Jun 18, 2010 at 12:01pm Jun 18, 2010 at 12:01pm UTC
I was about to write here that a semicolon was missing in the previous line... so your guess was right! Thanks!
Jun 18, 2010 at 12:57pm Jun 18, 2010 at 12:57pm UTC
I'm not a Windows guru but I am guessing that you may have that __cdecl in the wrong place?
typedef bool (__cdecl *tInitFunctionP)(void );
Topic archived. No new replies allowed.