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]
Other format: [Raw text]

RE: [pthreads-win32] How can you use errno with pthreads DLL?


   >>1. Recompile pthreads against the same runtime 
   >>library that you are using rather than MSVC.  
   >>This is more than likely the best solution as 
   >>having two different CRTs is nasty bloat: think 
   >>two separate heaps and copies of all support data 
   >>structure, not to mention the additional code size.

This is a good idea which would work. I might point out that 
we don't use the CRT for the most part; it is somewhat non-portable
(can't rely on half of the useful stuff existing elsewhere)
and not necessarily very efficient (with some exceptions), 
and we need both. So duplicating CRTs really has little ill 
effect for us. Also, VC++ no longer uses its own heap but 
rather redirects all allocations to the OS under WinXP and 
later OSs. 


   >>2. Explicitly import and use the function "_errno" 
   >>from MSVCRT.DLL.

OK, this is a good idea too. I was just hoping that pthreads 
could simply make such a thing available itself, as IMO it is 
not a good idea for a utility library to force the apps that 
use it to use a particular library configuration (in particular
one that has a history of causing problems for commercial software
developers due to problems with that way Windows deals with linked
libraries). What happens if I have another DLL from somebody 
else that has the exact opposite requirement (must use own CRT 
and not shared one)? 


   >>sem_* and sched_* do, so if you don't use those you 
   >>could bypass this problem.

Yah, it's the semaphore functions that write to errno and the ones
that are an issue for me. I thought I read somewhere that there was
a proposal to migrate sem_* to return error values and zero upon 
OK, but that's another story.

Thanks so much for the response. I will find a way to do one of the 
above or add my own GetErrno function to my copy of pthreads. I find
that pthreads-win32 is a great thing and am very grateful for the 
work that has been put into it.











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