Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sysctl and _ARRAY_SIZE



Hi,
I'm try to write some code to determine the amount of
physical memory available to my program. The method I'm
trying to use is...

  double mem_available;

  unsigned int physmem;
  size_t len = sizeof(physmem);
  static int mib[2] = { CTL_HW, HW_PHYSMEM };

  if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
	      && len == sizeof (physmem)) {
	mem_available = (double )physmem;
  } else {
	fprintf(stderr,
		"warning: unable to determine physical memory.\n");
	mem_available = 2e9;
  }

which compiles fine, but linking I get an error

/usr/bin/ld: Undefined symbols:
_ARRAY_SIZE
collect2: ld returned 1 exit status

Any one know what dylib I'm missing. or know a better
way to do the same thing (either unix or Cocoa).

Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.