Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Doctor Q

Administrator
Original poster
Staff member
Sep 19, 2002
40,077
8,337
Los Angeles
I have a large C program that runs under Unix and uses many Unix facilities, including forks, pipes, shared memory, memory mapping, semaphores, and signals.

I want to port it to run natively under Windows without redesigning all the code.

Ideally, I'd have a free, royalty-free, freely supported, and perfectly reliable Unix-emulation package or library that provides these Unix facilities seamlessly under Windows.

In the real world, what are my practical choices?
 

ChrisA

macrumors G5
Jan 5, 2006
12,904
2,149
Redondo Beach, California
Doctor Q said:
In the real world, what are my practical choices?

I think you want http://www.cygwin.com/

It come with everything you need, GCC compiler, libraries, X11 and so on. It's huge. but once installed your Windows PC will be very UNIX-like and can even run Gnome or KDE in an X11 window

Notice the "install" link on the page. It works well. It's free and hhas been around for ages. Redhat owns it now and will offer to sell you support. This will help and GNU autotools will work in the cygwin environment.
 

Doctor Q

Administrator
Original poster
Staff member
Sep 19, 2002
40,077
8,337
Los Angeles
Thanks for the quick answer, ChrisA. I had previously looked into Cygwin, but I didn't want to be required to distribute my source code (so I can get rich selling products I make out of it). Linking to Cygwin's library would make my code subject to the GNU General Public License, which requires that source code be made available.

However, I see that Red Hat sells some kind of license called The Cygwin Contract that bypasses the GPL requirement. I wonder what it costs?
 

Doctor Q

Administrator
Original poster
Staff member
Sep 19, 2002
40,077
8,337
Los Angeles
Doctor Q said:
However, I see that Red Hat sells some kind of license called The Cygwin Contract that bypasses the GPL requirement. I wonder what it costs?
I found the answer: $25,000 per year! That's a little steep for my plans. I was hoping for "free or cheap".

Now I'm looking into Interix. Thanks!
 

Doctor Q

Administrator
Original poster
Staff member
Sep 19, 2002
40,077
8,337
Los Angeles
wala said:
http://www.research.att.com/sw/tools/uwin/ - commercially permissive open source license/
This looks quite promising. The license seems to allow use in a non-open-source commercial product as long as the proper liability statements are included to protect other UWIN contributors.

wala said:
The one-time pice is reasonable, but they also charge me something like $700 per copy per year for products delivered to (my) customers. I'd have to pay them every year! So that's well out of my price range.
 

iMeowbot

macrumors G3
Aug 30, 2003
8,634
0
It seems that you may have aready ruled out Cygwin for license reasons, but I thought I'd chip in and mention that while it's pretty good, it's definitely not seamless. A few gotchas I remember:

If you rely on privileged IP port numbers for security, come up with something else. Windows has no direct equivalent.

In the same way, there is no direct equivalent to suid, or magical properties for UID 0. Careful about any built-in assumptions that rely on these.

File clobbering doesn't work, you need to implement your own switcheroo and make sure that interdependent processes won't be surprised by this.

Socketpair is dicey but these can typically be replaced by pipes.

mmaps get passed to children due to the way forking is emulated, which can interfere with the parent process.

I'm sure there were more bit of weirdness, but that's what I remember.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.