> 1- I need to find the equivalent of the win32
> GetSystemInfo(&systemInfo);
> systemInfo.lpMinimumApplicationAddress and
> systemInfo.lpMaximumApplicationAddress.
You can set lpMinimumApplicationAddress to 4096 and
lpMaximumApplicationAddress to 0xC0000000, but I'm not sure why you'd
care about either of those. Not all of that address space is available
to your application. There are probably better ways to accomplish
whatever you're trying to do.
> 2- Is there an equivalent of IsBadReadPtr on OSX?
int IsBadReadPtr(const void *ptr) {
kern_return_t result;
vm_address_t address;
vm_size_t size;
struct vm_region_basic_info info;
mach_msg_type_number_t count;
mach_port_t objectName = MACH_PORT_NULL;
address = (vm_address_t) ptr;
count = VM_REGION_BASIC_INFO_COUNT;
result = vm_region(mach_task_self(), &address, &size,
VM_REGION_BASIC_INFO, (vm_region_info_t) &info,
&count, &objectName);
if (objectName != MACH_PORT_NULL) {
mach_port_deallocate(mach_task_self(), objectName);
}
if (result != KERN_SUCCESS || address > (vm_address_t) ptr ||
info.protection == VM_PROT_NONE) {
return 0;
}
return 1;
}
> 3- Is there an equivalent to OutputDebugString on OSX?
What are you trying to do with it? You can write to /dev/console if
you'd like, or to stderr.
> 4- The lib I am porting is OSX only (no MacOS9 and down).
> I used pthreads for threading.
> I used the FileManager API for file operations.
> I used calloc and free for big memory allocations.
> Can you tell me if my choices are ok?
They're fine, though you might find it easier to use POSIX APIs for file
operations instead of the File Manager. And you should only use calloc
for blocks that have to be zero'd out before you can use them. Use
malloc for other allocations.
Hope this helps,
Eric

Signature
Eric Albert ejalbert@stanford.edu
http://rescomp.stanford.edu/~ejalbert/
> 1- I need to find the equivalent of the win32
Please read this:
<http://developer.apple.com/macosx/win32porting/>