Board index » cppbuilder » Question about errno and threaded application and DLL
Ross Johnson
CBuilder Developer |
Question about errno and threaded application and DLL2004-11-24 11:23:55 PM cppbuilder39 I've recently downloaded the free Borland Builder commandline tools and I'm trying to port a DLL and testsuite to it (pthreads-win32). The DLL builds ok but I have a problem getting it past the testsuite. The testsuite is failing on a test that sets errno inside the DLL and reads errno inside the appliation exe. From other tests that pass, here is what I see: 1) a test where the thread routine inside the exe sets errno and where main() reads errno works; 2) a test where the thread routine inside the exe calls a routine inside the DLL that sets errno and the same thread routine then reads errno fails; 3) noting that errno is a macro in the MT case: #define errno (*__errno()) a test that prints the value returned by __errno() from within the DLL, and also within the exe when both are part of the same thread, both pointer values are not equal. The same test run under GNU C or MSVC gives pointer values that are equal. Can anyone offer any help getting this to work please? It doesn't appear to be a case of incorrect options, but I'm willing to take any clues in order to get this going. The DLL and test apps are built multithreaded (-tWM), the DLL is -tWD of course, and the test app is -tWC. Thanks. Ross Johnson pthreads-win32 maintainer |