public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* sleep removed ?
@ 2012-07-11  8:59 Herbert Groot Jebbink
  0 siblings, 0 replies; only message in thread
From: Herbert Groot Jebbink @ 2012-07-11  8:59 UTC (permalink / raw)
  To: cygwin

Hi,

I was asked to make a little change in a c program from 10+ years ago.
The change itself was not the problem, but the environment is changed
and I did have compile problems.

Old: Cygwin: 1.3.2  (0.39/3/2)  2001-05-20 23:28
New: Cygwin: 1.7.15 (0.260/5/3) 2012-05-09 10:25

The problem was the sleep statement, that was not working anymore:

     /home/herbert/project/main.c:124: undefined reference to `_sleep'

Below (the relevant parts of) the old code:

    #include <unistd.h>

    /* Extra defenition for avoiding warning at compiling */
    #ifndef UNIX
        unsigned int sleep(int); /* somehow, compiler don't understand
it completely */
    #endif

    #ifdef UNIX
        sleep(1);
    #else
        sleep(1000);
    #endif

I changed it into:

    #ifdef _WIN32
    # include <windows.h>
    # define sleep(x) Sleep(1000 * x)
    #else
    # include <unistd.h>
    #endif

    sleep(1);

It compiles now, but is it also correct ?

The executable did go from 251 KB to 1034 KB, is this caused by
windows.h that is now included and not in the old version ?

Kind Regards, Herbert

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-11  8:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11  8:59 sleep removed ? Herbert Groot Jebbink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).