PDA

View Full Version : Convert 32bit program to 64bit version




james124816
Feb 19, 2012, 10:36 AM
how would you accomplish this..wanting to convert fancontrol for the macbook pro from 32 bit pref pane to 64bit pref pane.



hwojtek
Feb 19, 2012, 10:45 AM
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.

KnightWRX
Feb 19, 2012, 11:24 AM
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.

hwojtek
Feb 20, 2012, 04:10 AM
Yeah, but we're talking direct hardware access in this one.

KnightWRX
Feb 20, 2012, 06:22 AM
Yeah, but we're talking direct hardware access in this one.

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.

chown33
Feb 20, 2012, 09:41 AM
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.

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).

KnightWRX
Feb 20, 2012, 11:05 AM
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).

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.

Applemi
May 26, 2013, 11:14 PM
Is there a converter that I could download that covert programs from 32 to 64 bit.

Cromulent
May 27, 2013, 02:36 AM
Is there a converter that I could download that covert programs from 32 to 64 bit.

No.

weichsel
May 27, 2013, 03:15 AM
Is there a converter that I could download that covert programs from 32 to 64 bit.
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 (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Cocoa64BitGuide/ConvertingExistingApp/ConvertingExistingApp.html#//apple_ref/doc/uid/TP40004247-CH5-SW1).

ytk
May 27, 2013, 03:40 AM
Is there a converter that I could download that covert programs from 32 to 64 bit.

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: 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

gnasher729
May 27, 2013, 10:04 AM
how would you accomplish this..wanting to convert fancontrol for the macbook pro from 32 bit pref pane to 64bit pref pane.

Go to developer.apple.com and type "64 bit" into the search field. You'll want to study the 64 bit transition guide.

Mr. Retrofire
May 27, 2013, 07:26 PM
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.
He can use the IOKit:
Introduction to Accessing Hardware From Applications (https://developer.apple.com/library/mac/#documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Intro/AH_Intro.html#//apple_ref/doc/uid/TP30000376)