This is the mail archive of the
cygwin
mailing list for the Cygwin project.
sleep removed ?
- From: Herbert Groot Jebbink <herbert at groot dot jebbink dot nl>
- To: cygwin at cygwin dot com
- Date: Wed, 11 Jul 2012 10:58:46 +0200
- Subject: sleep removed ?
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