Apple Win32 to OS X Porting Guide
BoomerSooner writes "Apple has released a Win32 to Mac OS X Porting Guide for C/C++ developers.
This Guide is to get you started porting an existing procedural Win32 application written in C or C++ to Mac OS X.
It looks like Apple is getting a bit more aggressive toward Microsoft."
Get this!
It does wonders for cross-platform development.
Life is the leading cause of death in America.
That's funny. I'm on a Mac and yet my mouse has two buttons and a scroll wheel that can be a 3rd button.
And what are these "floppies" of which you speak?
~Philly
Cool....does Apple happen to have a similar guide to porting Unix apps to use the Cocoa interface? I know OSX supports X apps natively, but it would be nice to be able to make, say, the Gimp to be a true Mac app.
A sentence you'll never see on an Internet discussion board: "You know what? You're right."
Hit the wrong 'reply' link.
This should be a reply to this post.
~Philly
It's great to see all this documentation coming out. For the first couple of years, it was difficult at best to find any information about the internals of MacOS X. I still don't know of any decent reference for NetInfo administration. O'Reilly's helped alot though.....
The ultimate aggressive move would be to release Marklar, the x86 version of Mac OS X.
Karma: The shiznight, mostly because I am the Drizzle.
Wow that's a pretty short guide. I think it came be summarized as:
"Welcome to OSX, based on unix, which means you get protected memory, threads and other stuff. This is new to Macs, which is why we're even bothering to mention it.
Their are a poop-load of different ways to develop for the Mac; Cocoa, Carbon, Java, Classic and even old school bsd/posix, but since Carbon is the only one that resembles Win32 we will talk about that one.
I'm going to mention that Win32 message are a lot like the old school messages, doesn't this make it easy?, oh and we have some type of form/resource editor n' stuff.
Now to read more here are some other articles you'll absolutely need to read before you can anything... you know what.. Why don't you just come to the developer conference: Worldwide Developers Conference sessions on Mac OS X (available for purchase)
-Jon
this is my sig.
It looks like Apple is getting a bit more aggressive toward Microsoft.
Yeah, I heard the Fiji Islands are getting more aggressive towards the USA, too. Somehow, I don't think that will make much of a difference. Apple has two percent of the market, people. That's less than Linux. Hell, that's probably less than OS/2! If Apple had any guts, they'd release an x86 version of OS X. But they know they'd lose, so they won't.
I wish Apple would hurry the hell up and read the 'Porting OSX to x86' guide! :)
That would be some serious competition, and I know for one that I would definately go and buy a copy of OSX!
I think OSX is a fantastic systems, but I just cant afford, nor can justify the buying of a mac.
"Hey! Unless this is a nude love-in, get the hell off my property!!"
Ask any old man, he will tell you.
photosMy Photostream
I hate to say this, but this 'guide' is rather useless and looks to be little more than a reprint of marketing glossies. Don't get me wrong, I love OSX. But to imply that you can easily port MFC apps to Cocoa is humorous. Even rewriting an MFC app in Cocoa will most likely be highly frustrating due to your engineers having to change their mentality from one to the other.
Cat, the other, tastier white meat.
My wife's eMac is loud, but we are spoiled by the quiet G3's. My dual is not much worse than some PC's, but still I want silence when I am doing audio work.
photosMy Photostream
Sorry to repost this but it gets tiresome to see the same misinformation out there. read on.
/Applications/Utilities. Drag the terminal.app to the Dock
/Users
/etc/fstab file. It does not matter where you put it since the mac will ignore it. To mount the disks type "sudo niload fstab" followed by the file path name. However, don't do this right away till you have more experience. Instead do the following. /hostpath is the exported fs. The disk will be mounted in /Volumes and be "aliased" to the desktop.
/usr/bin/Netscape & /Applications/Netscape
Dear Unix user, welcome to mac. If you trust me you will just do all of the following without asking why, before you start whining about features you miss. The following is a no-fat-added list of essential customization for unix users converting to the mac world.
1. The Mouse.
Go buy a 3 button USB mouse. Make sure you get an optical mouse with a wheel. Buy the most expensive one you can. Heriditary mac users prefer a 1 button mouse, but you wont.
2. The Terminal.
Open
3. File system journaling
Open the terminal.app and type
sudo diskutil enableJournal
Just do it. This can be undone and you can change how you want it later.
4. The Compiler
Regardless of what compiler you prefer, you need the native compiler and libs. Go to
http://developer.lanl.gov and register for free. Enter the site and select the downloads option. Scroll through the list till you find "developer tools", download and install it.
5. Installing GNU ports part 1.
Goto http://sourceforge.com and find the latest stable release of "fink" for mac os X. download and install it. There will be some questions to answer, just choose the defaults except if offered, ask it to get updates from CVS.
6. Install X-windows part 1
If you have 5 hours to you can wait, type in the terminal
fink install xfree86-rootless
this is preferred as it gets the latest release of a fast changing package.
If you are in a hurry you can install the binary.
Type
sudo dselect
Quick intro to dselect: after some preliminaries you are offered the chance to choose packages from a list. Use the down-arrow key to move down and find xfree86-rootless.
Press the + key to select it. You will be offered "conflict resolution": accept the defaults by pressing return. Then return again to exit the selection. DO NOT GET GREEDY and select other packages yet. Finish the installation.
7. Installing X-windows part 2: the window manager
You may prefer fvwm2 or some other window manager but take my advice and try out oroborus first. Oroborus does things the mac way, and later you will be glad you did even if its not familiar at first. Oroborus deliberately eschews many popular features, letting the OS provide those services. For example, if you want virtual screens you DO NOT want them as part of the windows manager! You want them as part of Aqua so that they apply to both aqua and to x-windows. Likewise you want the Dock to manage minimizing windows not the window manager.
Go to http://apple.com click the OSX tab, then the downloads tab and find oroborus.
Note: the oroborus that comes with Fink/dselect is not quite the same thing.
8. Installing GNU ports part 2.
Use dselect or fink to install a few packages. Fink has about 2000 packages available including your favorite parts of kde and gnome. To see what's avalaible type
fink list | more
just for practice try installing gv (ghost view) and xemacs.
Remember, dselect will install binaries (fast), and fink will install source (slow), generally dselect is a good idea. Once a month type "fink update-all" or update packages in dselect.
9. Text editor
Goto http://www.barebones.com and get a free copy of bbedit "lite". I recommend buying the full version, especially to geeks. Note that you can save files in unix/mac/PC formats which have different end of line characters. Despite the name, on a mac you should normally use unix format. Mac mode is mainly for historic reasons but gums up unix commands. Even if this (amazingly) does not turn out to be your preferred editor, you should install it anyhow so that it is there for guests.
10. Mounting network disks
You can mount NFS disks by creating a file that looks just like the usual
In the finder window, select go>servers. In the text field type
nfs://xxx.xxx.xxx.xxx/hostpath
Where xxx.xxx.xxx.xxx is the ip address or domain name of the host with the disk, and
To mount windows network disks we use
smb://xxx.xxx.xxx.xxx/path
Be nice and unmount your disks (throw them in the trash) before disconnecting from the net.
11. using X windows across the network.
All the usual stuff (like xhosts and DISPLAY) works as expected. However you do need to activate oroborus (which will fire up X-windows) since its not on by default. However, before you do this let me suggest an alternative you may find better. Goto http://apple.com and on the osx downloads page locate VNCdimension (or VNCthing) and install this application. On the X windows client, run vncserver. And on the mac attatch to it using VNC dimension. On anything but the fastest network connection you will find this smoother and faster than using x-windows. Plus its more secure and even runs through firewalls. At present much of X-windows on the mac is not graphics accelerated, but VNC dimension which runs in aqua is.
12. Shortcuts worth knowing about
On your unix machine to run netscape you type
on a mac you type
open
to open the file browser at the current working directory type
open . (note the period)
to open a web page type
open http://macosxhints.com
13. Pitfalls
There are few pitfalls in the file system you need to know about early on.
First be careful with cp,mv,rsync, and tar. For 99.9% of the time they work as expected. But a lot of mac applications and mac documents store info in something called the "resource fork" of a file. Unix files only have a single data fork. Mac files have a data and a resource fork. The data fork is the same as what you would see on the unix system. The resource fork can contain almost anything, but usually contains unimportant meta-information about the file itself like what app created it, and so on. But sometimes it contains crucial information (e.g quicken).
When you do a unix cp or mv or tar all you get are the data forks. The rule of thumb is this: if your file can be used by a unix program then dont worry about the resource fork. Most modern mac apps do not use the resource fork but older ones do.
Second, mac filenames are case-insensitive but case preserving. Thus ReadME and readme are the same file.
Third, unfortunately, for backwards compatibility there are two different kinds of soft links on a mac. One is the usual unix soft link and the other is the "alias" function of the OS. The OS is smart enough to recognize the unix links and treat them as file aliases in the GUI. But the reverse is not true. Generally you are better off using the unix soft links.
Fourth, macs have three layers of file permissions where unix has one. Macs have the usual unix permissions. Plus there is an ability to lock a file against changes or deletion, and finally there is the ability to lock a file against modification even by root. generally you wont ever need either of the latter two, but you may someday find a file you cant seem to delete! just in case, the normal file lock is accessed via "get info"
Fifth, fstab, exports, shadowpassword, passwd, and most unix configs don't work the way you expect. Use the admin tools to alter netinfo configuration data. (see root below)
14. Thinking mac-like.
First off you never need to touch the other mouse buttons outside of x-windows. Second, try to adopt apple applications where they exist to replace you current favorites. For example, use the mail.app instead of pine or Eudora. Sure these have nice features, but long term apple apps will stay more tightly integrated: for example, mail.app links to addressbook which links to iCal. Third, Chill-out dude. Macs force you to do things a certain ways with warning dialog boxes or focus-on-click windows. These are not worse than other ways, and long term you will come to see the benefits from the cross-application uniformity of operations. Unmount disks, especially network disks, by tossing them in the trash. (you may want to add an eject button to the finder menu)
15. Viruses, Worms, holes, etc...
Regularly use the software update feature. Bugs get patched quickly. Historically, the only security holes you must stay on top of are Microsoft Internet Explorer holes, Microsoft Entourage/outlook holes, and Microsoft macro viruses. Don't bother worrying about anything else till you worry about these. Many people use Chimera for this reason.
16. Root
If you read just one book try "mac OS X for unix geeks", most other books aren't for you because they are trying to explain unix to mac-heads. Avoid using root when you can use an admin tool or sudo instead. Apple has not fully document root admin, so stick with tools. Except don't ever play with netinfo manager or niload until you have a lot of experience, as there is no faster way to make your mac unbootable.
17. Goodies
There are virtual window managers at mac OSX downloads.
Try out Watson at http://www.karelia.com/watson/
Microsoft office X is a great program even if it is made by Microsoft.
Scientific plotting: You may like Igor from wavemetrics.com since it has both command line and menu driven interface. Fink comes with R, Octave and Gnu-plot. Mathematicians may prefer mathematica.
If you have a powerbook, put the dock on the left and make it small.
Turn off autostart on OS 9.0
Discover iTunes.
Consider a mac.com account
Read http://macosxhints.com
Some drink at the fountain of knowledge. Others just gargle.
I hear this type of thought a lot, but is it really true? I've been logging some serious time with osx and the mouse drives me crazy--if I want to use it for any length of time I unplug my logitech 4 button + wheel mouse from my PC and hook it up to the mac.
I thought I wouldn't use the thumb+middle buttons incidentally, but copy+paste in windows just speeds me up so much. Likewise I find it difficult going back to a computer that doesn't have a wheelmouse.
Well, as long as those lazy open-source developers hurry up and follow the guidelines.
Man, I'd hate to be your kids.
From the guide: You will use Interface Builder to translate your application's visual appearance into the visual appearance of a well-designed Mac OS X application.
You don't need to see his interface specification. These aren't the design elements you're looking for. He can go about his development.
moto411.com
Are you high or just incredibly stupid?
Don't trust computers with only one mouse button that won't let you eject floppies on your own.
The Mac I'm using to type this has a three-button wheel mouse. No drivers required - I plugged it in and it worked.
And as far as floppies go - not that I use them any more - I wouldn't trust a system that allowed me to easily eject removable media without unmounting the filesystem first.
Lost: Sig, white with black letters. No collar. Reward if found!
If they were really serious about seeing developers adopt Cocoa they would have released API's allowing native access from C++.
Instead, they were more interested in punishing everybody who didn't jump on the Objective C bandwagon back in the '80s.
Is this truly the only Earth I can live on?
Oh yeah, but the other 10% are the ones that do the interesting programs that 90% of the people use ;)
I don't think Apple is particularly obsessed about getting VB developers to migrate at any rate...
I want some of what you're smoking.
Stating on Slashdot that I like cheese since 1997.
To summarise, it basically says: "We support OpenGL, so if your app uses OpenGL, you'll have no problem". It then goes on to list a few things about OpenGL, which a seasoned OpenGL developer would already know.
At no point does it say what you should do if your Windows app is written using Direct3D. Not even a link to a D3D-to-GL porting guide.
Regardless of the relative merits of the two APIs, it's an undeniable fact that many 3D Windows apps use Direct3D, and it therefore seems like a pretty huge oversight for Apple to not even mention how one might go about porting them.
didn't you see the switchers campaign????? isn't that just a bit aggressive?
lemme guess, you've been wearing that Ellen Fiess t-shirt this whole time, and couldn't remember why or what the ad was about?????????
"You never want a serious crisis to go to waste." - Rahm Emanuel
1. Hardware: OSX will only run on a small percentage of hardware, insuring that its stability is much higher than that of Windows. If OSX were to move to x86, then it would have to support the huge swath of shitty hardware, bringing down its stability level a great deal.
2. Customer Outrage: Mac users & Mac zealots pride themselves on being different from everyone else. If Apple made OSX available to the horde of beige boxes, they'd riot and go looking for Steve Jobs' blood.
3. No MS Office: If OSX is released for x86, you can be damn sure that Microsoft won't port Office to it at all. And while you can use OpenOffice, or any other office app, most people don't realize they exist, and won't use them.
The only reason I keep my Windows partition is so I can mount it like the bitch that it is.
Define real
photosMy Photostream
Or perhaps Apple just had the crazy notion to discuss the cocoa analogues to the Win32 API in the hopes of attracting more developers into porting their apps to OS X.
No Win32 with an interest in their prosperity is going to drop the holy grail for the styrofoam cup.
Microsoft bought $150 million of Apple Shares. And as the market works, Apple never saw that money. The investors that sold the shares at the time saw the money.
As a rock-in-roll Physicist once said, No matter where you go, there you are.
I find it interesting that not only does the article mention the Classic API but almost promotes the API. They never mention that Apple wants to migrate away from Classic, they only mention the pro's and con's of Cocoa vs. Carbon
All you need to know is wxWindows. The wxWindows library is quite similar in terms of design and functionality to Win32, and once you have ported to it, you can compile your application for Win32, Linux/X11, OS X, and several other platforms.
That's not quite right. There is an X11 server that runs on OS X, a port of XFree86. But it works by doing drawing off-screen in software and then blitting the result into OS X windows. While it's usable, it's not what I would consider a high quality implementation. It's also too confusing to install and use for regular Mac users.
OS X could support X11 natively so that the difference between an X11 application and a Cocoa application would appear to be no larger than the difference between a Carbon or Classic application and a Cocoa application, but Apple has chosen not to be that compatible.
but it would be nice to be able to make, say, the Gimp to be a true Mac app.
That would mean making an OS X backend for Gtk+. That may well happen (there is a Win32 backend). It's really a question of resources and volunteers. Do you volunteer?
You can probably port to Linux fairly easily using GNU Step. However, you are probably better off rewriting the GUI using some Linux-native toolkit like Gtk+: Macintosh applications tend to behave in ways that appear inconsistent and cumbersome to Linux users.
You mean Linux?
You know, your compelling argument has shown me the way. I mean... *I* have one butt, why shouldn't my mouse? And it should definitely match the color of my CPU - that dark silicon sheen is pretty sexy.
You're confused, friend. Apple never claimed the classic Mac OS was especially reliable. The fact that the OS could crash, or that an application crash could cause the OS to appear to have crashed, was well known. Apple only claimed (truthfully) that it was easier to use a Mac than a computer running one of the other operating systems.
I write in my journal
Well, fuck you right back. And Merry Christmas from those of us who enjoy Macintosh desktops.
This is my post. There are many others like it. If you don't like what you read here, go try one of the others.
Ask your wife.
;-)
Okay, I'm sorry. But you did post AC, after all.
This is my post. There are many others like it. If you don't like what you read here, go try one of the others.
Don't Forget X-Chat Aqua
http://xchataqua.sourceforge.net/
-- oh.... so..... sleeeeeepy.
What color is the sun on your world?
Seriously: you statement is so head-in-the-clouds-theoretical I have trouble seeing it as anything other than parody. There is no, REPEAT NO, other way 99% of the people in the country will buy things than go to a store/order online and recieve something in a box.
I'd suggest you spend less time deciding how the world will work and more time away from the computer.
I am a believer of momentum and curves.
And the fact that Macintosh is built around that model is going to hurt it badly.
How on earth is the Mac "built around that model"? That makes no sense at all considering Apple gives away their high-quality IDE and actively supports open source. Perhaps you mean that Mac developers haven't traditionally been involved in open source; this is true but rapidly changing.
My parents were asking me: why can't we just run all those Linux games? Well, sorry, they don't run on OS X.
They probably would if you installed Fink. There are dozens of Gnome and KDE games available as Fink packages, and others can be built easily.
And even after you track stuff down, installing it on OS X is confusing for the average user: drag this here, drag that there, click here to let me do this, click there to let me do that, etc.
Once again I have no idea what you're talking about. To install: drag app to "Applications" folder. To uninstall: drag app to trash.
Microsoft has lots of influence on Apple, and Apple won't be able to get out of DRM
I see no evidence for either of these assertions.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
Fink is a god-awful mess, not suitable for mainstream users. Neither is X11 on MacOS, which is very poorly integrated with the rest of the Mac desktop.
Once again I have no idea what you're talking about. To install: drag app to "Applications" folder. To uninstall: drag app to trash.
Yes, for nerds like you and me, that's easy. For regular users, it isn't. Trust me: I deal with regular users, you apparently don't.
How on earth is the Mac "built around that model"? That makes no sense at all considering Apple gives away their high-quality IDE and actively supports open source.
Again, spoken like a nerd. Apple's open source support for IDEs and other tools is not relevant to end users. The applications that make the Mac platform attractive to end users are sold, require installation, and don't come with the OS.
Most of the time, you don't have to install anything on Linux because it comes with a huge amount of software as part of the system. When you do need to install something, yes, it's easier than on OS X.
Also, it DOES NOT get any easier than installing on OS X. Usually it is a drag of a folder or a click of an icon.
Yes, and that's terribly confusing to many users. Where should you drag it? How do you find it when you have dragged it there? How do you update it? How do you get rid of it? What depends on it?
Can you tell me which "button" you press to install the latest version of perl?
Sure: pop up whichever package manager you like and click on "Perl". "Synaptic" or "webmin" are easy to use. What is particularly nice when supporting Linux is that you can tell people "just type 'apt-get install something'" over the phone--much easier than walking people through a download and install.
OS X software installation and management is primitive and dysfunctional in comparison.
I guess you missed the "a bit more". Notice the word more. Here is a definition:
more ( P ) Pronunciation Key (môr, mr)
adj. Comparative of many., much.
Greater in number: a hall with more seats.
Greater in size, amount, extent, or degree: more land; more support.
Additional; extra: She needs some more time.
So as you see I said "more" which is in reference to the previous attempts to take MS market share.
Maybe next time you pull your head out of your ass you'll figure out what the fuck I was saying.
Dipshit.
Please please please please please!
Pooty tweet
I'm sorry, but I do have to jump into the fray here.
.
I read people on this board constantly talking about the need to have options when it comes to software and hardware. Then I read this post and the author wants to lessen the available options for processors by advocating Apple dropping the PowerPC and going with X86. Would the author be upset if Apple dropped PPC and went with Transmeta? Or with Power4 (or it's offspring the PPC 970)?
Apple is making money (read profits) with their current business strategy. $4 billion in the bank is hardly hurting them. They are kicking Avid's ass all over the place in the realm of non-linear video editing because they are the lowest cost option with a very high level of quality
Also OS X on Intel would bring down the wrath of the 800 lb gorilla like no one has seen before. Bang! Office v.X.... Gone! Bang! No more development of IE for the Mac. Right now OS X on Intel would be pure suicide for Apple. I know they're keeping their eye on the possibility of some such move, but in the near future it just isn't going to happen.
As for games... pshaw. All I really need in terms of apps are Final Cut Pro, Photoshop and Illustrator and I'm happy. I GET SHIT DONE with those apps. How productive can one be playing Unreal Tournament or "insert inane first person shooter title here" anyway?
And who really cares if we don't have some OSS Barbie's Makeover complete with source code or any of the other cheapo games that comprise the ever so rich tapestry of entertainment that is PC gaming?
Pooty tweet