What does "int (__cdecl *)(void)" mean?

Hello all,

I'm not sure if this should be posted in the beginners forum, but I'll take my chances.

I'm currently messing around with DarkGDK and I get an error I do not understand.
The error is
"C2446: '!=' : no conversion from 'int' to 'int (__cdecl *)(void)'" and the code at that line is

for(; dbGetFileType != -1; nAmountOfFiles++)

where "dbGetFileType" returns an integer.

I couldn't find understandable information on where the "(__cdecl *)(void)" part in the error comes from. So my question is: what does it mean (and why does this line not work) and why does the compiler see '-1' as a different type than an int here?
You get it backwards.
dbGetFileType is a function. You need to call it like dbGetFileType()
Oh god. How foolish of me, how could I miss that.

It works now, thank you. I still don't understand what that __cdecl stuff means though and google doesn't really help me.
int (__cdecl *)(void) is the type of dbGetFileType. It means that dbGetFileType is a
function that takes no arguments, returns an int and follows the __cdecl calling convention.

Useful link -> http://www.codeproject.com/KB/cpp/calling_conventions_demystified.aspx
Thanks a lot m4ster r0shi, that clears things up.

Question answered!
Topic archived. No new replies allowed.