Windows equivalent API in MAC

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

  1. macrumors newbie

    Joined:
    Apr 4, 2008
    #1
    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. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #2
    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. http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/atomic.3.html

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

    Even in Windows, you should avoid using this method:
    Code:
    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.

    http://developer.apple.com/document...Conceptual/CFStrings/Articles/Converting.html

    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.

    http://developer.apple.com/document...eference/CFLocaleRef/Reference/reference.html

    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): http://developer.apple.com/document...SRecursiveLock_Class/Reference/Reference.html

    MPEnterCriticalRegion (Carbon): http://developer.apple.com/document...MultiproServ/03tasks/chapter_3_section_9.html

    pthread mutexes (POSIX/Carbon/Cocoa):
    http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/pthread.3.html

    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... http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFPlugIns/CFPlugIns.html
     
  3. thread starter macrumors newbie

    Joined:
    Apr 4, 2008
    #3
    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-
    VarDecFromR8
    VarI2FromCy
    VarI2FromDec
    VarI2FromI1
    VarI2FromI4
    VarI2FromR4
     
  4. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #4
    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. macrumors newbie

    Joined:
    Apr 8, 2008
    #5
    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 oDesk.com 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. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #6
    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. macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #7
    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. macrumors newbie

    Joined:
    Aug 25, 2009
    #8
    Windows equivalent API in MAC

    Hi
    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. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #9
    If you're using Cocoa, it's an NSOutlineView.
     
  10. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #10
    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