-
March 8th, 2007, 08:10 AM
#1
_CrtSetReportHook problem
I have created my own memory management class which basically detects where there are memory leaks in the program. To improve this further i wanted to create my own report hook, so ive constructed the function, just like told on the msdn:
int YourReportHook( int reportType, char *message, int *returnValue );
and ive called the set hook method
_CrtSetReportHook(YoutReportHook)
and when compiling i get this error :
error C2664: '_CrtSetReportHook' : cannot convert parameter 1 from 'int (int,char *,int *)' to 'int (__cdecl *)(int,char *,int *)'
None of the functions with this name in scope match the target type
ive just followed what was on the msdn and this wont compile! any ideas?
-
March 8th, 2007, 01:01 PM
#2
Re: _CrtSetReportHook problem
Sounds like you're compiling your code as C++. Try adding:
Code:
extern "C" int YourReportHook( int reportType, char *message, int *returnValue );
Viggy
-
March 9th, 2007, 08:29 AM
#3
Re: _CrtSetReportHook problem
This made no difference either. Is it impossible to use these hooks if your creating a method that is a member function?
-
March 9th, 2007, 11:16 AM
#4
Re: _CrtSetReportHook problem
Oh, well, see, you didn't say that in your original post!
Yes, you can, however the member function of the class must be static.
Viggy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|