Convert 32bit program to 64bit version

Discussion in 'Mac Programming' started by james124816, Feb 19, 2012.

  1. macrumors newbie

    Joined:
    Feb 4, 2012
    #1
    how would you accomplish this..wanting to convert fancontrol for the macbook pro from 32 bit pref pane to 64bit pref pane.
     
  2. macrumors 6502a

    hwojtek

    Joined:
    Jan 26, 2008
    Location:
    A small rural village in western Poland
    #2
    1. Get ahold of source code and adjust it for 64 bit architecture.
    2. Compile for 64-bit (or even better do a 32/64 fat binary).
    3. Debug all combinations of hardware vs architecture.
    4. More changes to the code.
    5. Compile again as in 2.
    6. Go to 3.
    7. If it works, sell it. If no, go to 3 again.

    Thank you for using my impromptu "There is no 64-bit version of an app I really need to use because otherwise" programming workflow.
     
  3. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #3
    Most of the time, there really is no real work to do aside from just recompiling for a 64 bit platform. APIs/Frameworks and code using them are becoming more and more size agnostic as far as variables go. There really is little code left that assumes a specific memory size for a specific variable and that doesn't use "garanteed" size types like uint32 or other such things.
     
  4. macrumors 6502a

    hwojtek

    Joined:
    Jan 26, 2008
    Location:
    A small rural village in western Poland
    #4
    Yeah, but we're talking direct hardware access in this one.
     
  5. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #5
    You can't do direct hardware access on OS X unless you're running in kernel space. Fancontrol runs in user space as far as I can see. Also, the OP is asking from the Preference pane, which is only a front-end. the actual control of the Fan is done by a userspace daemon launched on startup.

    I don't have access to the source code, lacking a working DMG extractor, so I can't look more deeply into it, but really unless there's code in there that assumes variable width (like int = 4 bytes), then it's just an issue of building a 64 bit binary.

    With the source being available (at least for the version I found), it shouldn't be a tremendous task.
     
  6. macrumors 603

    Joined:
    Aug 9, 2009
    #6
    There is no reason that a daemon would need to be 64-bits, even if the pref-pane that talks to it is 64-bits. Separate processes, separate architectures.

    So it's quite possible that the daemon could remain 32-bit, while the pref-pane could be converted to 64-bit (assuming it needs any conversion at all, other than recompiling for 64-bit).
     
  7. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #7
    I don't think that was ever put into the question. I only pointed out that the OP was only wanting a 64 bit pref-pane.
     
  8. macrumors newbie

    Joined:
    May 26, 2013
    #8
    Is there a converter that I could download that covert programs from 32 to 64 bit.
     
  9. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #9
    No.
     
  10. macrumors newbie

    Joined:
    May 23, 2013
    #10
    Apple provides a script that helps to port an existing 32-bit codebase to 64-bit.
    While it doesn't exactly convert (compiled) programs from 32-bit to 64-bit, it at least helps to convert the source code.

    The script can be found in Apple's 64-bit Transition Guide.
     
  11. ytk
    macrumors regular

    Joined:
    Jul 8, 2010
    #11
    It's actually really easy. 64 bits is twice as much as 32, so all you need to do is double up the program like this:
    Code:
    cat 32bit_ver 32bit_ver > 64bit_ver
    If you want to really future-proof things, cat together four copies of the program to go all the way to 128-bit. :D
     
  12. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #12
    Go to developer.apple.com and type "64 bit" into the search field. You'll want to study the 64 bit transition guide.
     
  13. macrumors 601

    Mr. Retrofire

    Joined:
    Mar 2, 2010
    Location:
    www.emiliana.cl
    #13

Share This Page