Mac memory status functions?

Right now, I have a routine to get system information. Part of that routine is below - it finds how much physical memory your system has. The catch is I'd like to actually implement it for Macs but I can't since I can't find the equivalent functions for Macs. The only thing I found was FreeMem in MacMemory.h but I'm not sure if that's what I want and it would only solve half of my problem.

Ok, so if you could just look at this code to make sure I have the right idea with the Gestalt thing... I wasn't sure what OSErr would return upon failure so I just assumed it would be -1 - I need someone to tell me what it actually is though. Anyway, the new code is below.

Actually, better yet, I added a few more things (that right now are Mac only) with this Gestalt. Assuming I understood it right, any chance I could get someone to compile this, just to make sure my syntax is right? I also looked at sample code and found the noErr value so now I check against that.