This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: pthread definition and STL...


The C language allows defining pointers to undeclared structs.
The implementation took advantage of this fact in order to
accomplish two goals:

1) Hide the implementation from the users... you should be able
   to rebuild the library/dll and drop it in without having to
   recompile the user's code. This is accomplished by only
   defining the structures for the actual implementation. The
   users are only exposed to pointers to undefined structs.

2) Taking into account 1), instead of simply using the definition
   typedef void *		pthread_t
   which would work,
   using
   typedef struct pthread_t_	* pthread_t
   allows stronger type checking in that you cannot pass a pthread_t
   accidentally into, say, a method expecting a mutex
   (whereas, declaring them all (void *)looses this.


To come up with a solution that would preserve the above two points
needs to be investigated.
Your workaround of including "implement.h" (previously posted) will
work in the short term.

I'll see if I can work out a solution that will permit you to use
STL with these incomplete pointers.

John
-----Original Message-----
From: Ales Pour [mailto:pour@princip.cz]
Sent: January 16, 2001 4:19 AM
To: pthreads-win32@sources.redhat.com
Subject: Re: pthread definition and STL...


"Bossom, John" wrote:
> What error are you getting from the system?

Compilation stops with:

...\include\stl\stl_construct.h(58) : error C2027: use of undefined type
'pthread_t_'

This is in case of SGI's STL. With MSVC's (Dinkumware's?) STL its the
same error:

...\VC\INCLUDE\xmemory(33) : error C2027: use of undefined type
'pthread_t_'

Ales Pour

--------------
Ales Pour
Princip a.s.
Czech Republic

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]