pipe() and fork() not standard?

Jul 6, 2012 at 6:50pm
I am not able to use pipe() and fork() on windows. Aren't functions like pipe() and fork() part of Standard C/C++ library?

What's a good library that'll allow me to use pipe() and fork() for making windows executables.
Last edited on Jul 6, 2012 at 6:50pm
Jul 6, 2012 at 7:03pm
You should consider an alternate method to fork() on Windows for concurrency. You'll find it's common to use threads, and you can create a new process, but I don't think you can fork a process in Windows at all.

Do you know what the main difference between Apache v1 and v2 is? Threads rather than fork, probably for this reason.
Last edited on Jul 6, 2012 at 7:04pm
Jul 6, 2012 at 7:09pm
Is there a library that will enable me to use the same source code (which uses fork() and pipe()) to be run on windows platform.

Isn't there a Standard way of doing it??
Jul 6, 2012 at 7:12pm
I've never heard of such a thing, so I'd say no. But maybe someone else may know of something. And even if something managed it, I can't imagine it making the best use of Windows resources. It's just not the Windows way of doing things. And Windows is slow enough as is don't you think?
Last edited on Jul 6, 2012 at 7:13pm
Jul 6, 2012 at 7:21pm
:((
by standard way i did not mean the windows way. And I agree Windows is certainly not the best OS.

All I wanted to know was whether Standard c++(100% code portability) offers an alternate to fork() and pipe().
Jul 6, 2012 at 7:28pm
If you have C++11, use std::thread etc.

Otherwise, you can use boost::thread (basically std::thread for pre-C++11).
Jul 6, 2012 at 9:53pm
cygwin provides a posix like api, including fork and pipe, on Windows. However, I know almost nothing about it so can't offer much advice other than that.
Jul 7, 2012 at 5:41am
kev82 even if I get cygwin my executable will be an exclusive linux app and not be able to run on other Windows OS with no cygwin.
Jul 7, 2012 at 10:43am
closed account (S6k9GNh0)
Truly, fork isn't as beneficial as its made out to be. Any OS since 2000 seems to be capable of threading so why not use them? Much lighter, easier to initialize.
Last edited on Jul 7, 2012 at 10:45am
Jul 7, 2012 at 12:19pm
Windows is a different OS, and it does not fork(). (Sometimes it can be made to, using undocumented -- i.e. changeable -- APIs, but that's that.)

Windows actually has a very simple, intelligent, modular design. Also, forking is a stupid idea to begin with. It isn't a very friendly way to do things.

Use Boost threads. :O)
Topic archived. No new replies allowed.