This is the mail archive of the
pthreads-win32@sourceware.cygnus.com
mailing list for the pthreas-win32 project.
Re: Linking pthread.dll to another dll
- To: Erik Hensema <erik dot hensema at group2000 dot nl>
- Subject: Re: Linking pthread.dll to another dll
- From: Mumit Khan <khan at nanotech dot wisc dot edu>
- Date: Tue, 09 Nov 1999 09:39:29 -0600
- cc: "'Pthreads-win32'" <pthreads-win32 at sourceware dot cygnus dot com>
Erik Hensema <erik.hensema@group2000.nl> writes:
> Hi,
>
> I'm porting a shared library from Unix to NT, and I'm using pthread.dll for
> the multithreaded support.
> I'm having trouble using errno and the lib. Using the debugger, I can see
> that errno seems to be a function (huh? why does errno = x; work???). In my
> source, errno is a variable. Obiviously, errno doesn't change after a call
> to a pthread function.
>
> What can I do to make errno work? And, how is errno implemented in the
> pthread dll? Is it some C++ syntax or something? My source is Ansi C.
The errno is implemented as a macro on (most, if not all of the) MT
capable runtime libraries, and you need to be careful not to make the
usual mistake that's in lots of code developed under older varieties
of Unix:
extern int errno;
/* use errno. */
The correct form is:
#include <errno.h>
/* use errno. */
Regards,
Mumit