Windows equivalent API in MAC

Discussion in 'Mac Programming' started by prashantmirge, Apr 6, 2008.

  1. prashantmirge macrumors newbie

    Apr 4, 2008
    Is there Equivalent API in MAC
    for the following API's in window.
    1. InitializeSecurityDescriptor
    2. InterlockedCompareExchange
    3. InterlockedDecrement
    4. InterlockedExchange
    5. InterlockedIncrement
    6. IsBadReadPtr
    7. IsValidCodePage
    8. IsValidLocale
    9. IsValidSecurityDescriptor
    10. IsWindow
    11. KillTimer
    12. LCMapStringW
    13. LeaveCriticalSection
    14. LoadLibraryExW
  2. Krevnik macrumors 68040


    Sep 8, 2003
    A very unusual question... as some of these belong to a collection of APIs, and you apparently don't seem to care about the rest of them or have already found something equivilent.

    You also leave out a lot of information, which makes it really hard to help you. You will need a give some more information on what you are trying to do on some of them if you expect us to answer you in a helpful manner. I have done my best to be helpful where the answer is easy enough to find.

    Depends on what you want to do with said descriptor. This isn't something that can be answered based on how little information you provide.

    You want the OS APIs that do atomic operations on integers.

    No, and there is no usefulness in such a method.

    Even in Windows, you should avoid using this method:
    Important  This function is obsolete and should not be used. Despite its name, it does not guarantee that the pointer is valid or that the memory pointed to is safe to use. For more information, see Remarks on this page.
    Encodings are handled fairly differently on OS X than Windows. Instead of assuming you are using wide string arrays like in Win32, OS X wraps up all the encoding nastiness behind CFString and NSString. So converting from one to another is done using the CFString API directly.

    As for checking if a code page or locale is valid... all code pages supported by the OS are valid. If you want information on the preferred and known locales that the system has, you can use the CFLocale API set.

    This is very specific to what you are trying to do. In Carbon and Cocoa, they have very different handling of windows (as the developer sees them, anyways)... so I can't really give any generic advice here without knowing what the code is trying to do.

    The API collection you use to create and setup the timer will have a similar API for killing the timer. You will want to use the documentation you (hopefully) looked up on how to create a timer to find out how to tear down the timer you are using.

    You will want a mutex on POSIX systems (like OS X) rather than a critical section. They offer the same behavior. You can do this a few different ways.

    NSRecursiveLock (Cocoa):

    MPEnterCriticalRegion (Carbon):

    pthread mutexes (POSIX/Carbon/Cocoa):

    This entirely depends on what you expect to do with the library you are attempting to load. For DLLs that your app requires as a framework/library, there isn't really any replacement. Dynamic linking is handled quite differently on OS X in general, and your code will have to adapt.

    If you are trying to provide a plugin architecture, the mechanism for doing so is very different. Apple does have guides for this...
  3. prashantmirge thread starter macrumors newbie

    Apr 4, 2008
    I could able to find for some of API call. but now i want to know is there any equivalent API function in MAC for following windows api-
  4. wrldwzrd89 macrumors G5


    Jun 6, 2003
    Solon, OH
    My understanding is that these functions are only needed because of the way Windows handles data of type "Variant". Since this type doesn't exist in the Mac APIs (as far as I know, along with the Currency and Decimal types), these functions are not needed. If you need to work with generic data, currency data, or decimals, you can use void pointers, floats and doubles to accomplish this, and type casts to convert between them.
  5. shaggy.mac macrumors newbie

    Apr 8, 2008
    Based on your two posts, it looks like your job is to convert a Windows app to Mac OS X. If thats the case then please use to hire someone or make the information on the post more clear. Nothing is worse than trying to trick someone into doing your work for you.
  6. Krevnik macrumors 68040


    Sep 8, 2003
    The thing that worries me here is that it looks like a brute-force port, rather than hiring someone who knows both platforms well enough to do a clean port.

    It will result in a lot of wasted time an effort, IMO.
  7. yeroen macrumors 6502a


    Mar 8, 2007
    Cambridge, MA
    Not that it bears repeating, but porting an app from Windows --> OSX (or any UNIX variant), is highly non trivial if the Windows APIs were used.
    Merely mapping or attempting to map Windows function calls to OS X/POSIX calls on a one-to-one basis will only take you so far. It's much more than a straight port, you're looking at an entire redesign.
  8. sabharwal81 macrumors newbie

    Aug 25, 2009
    Windows equivalent API in MAC

    I am looking for a MAC equivalent of Win control CMFCShellTreeCntrl. Actually i want to draw a control on mac that displays files in any folder as a tree structure, same way as XCode/finder represents files.
  9. kainjow Moderator emeritus


    Jun 15, 2000
    If you're using Cocoa, it's an NSOutlineView.
  10. gnasher729 macrumors P6


    Nov 25, 2005
    Instead of joining MacRumors to ask questions that you need for your job, why don't you ask your company to invest in some training? Buy a bunch of Cocoa books, get an Apple developer account, download the training movies, that kind of thing.

    You are missing the point. This kind of job is outsourced, so some manager realizes huge money savings and gets a huge bonus, leaves the company before the **** hits the fan, and then the next guy has to hire some proper Mac developers to fix it or the project dies. The important thing is the bonus for cost savings that gets paid out.

Share This Page