I installed Ruben's latest win32 build of mingw-w32 this afternoon and 
immediately ran it runtime issues with third party libraries (one of which is 
boost) that I'm using in my application.  After some analysis, the root of the 
issue is that the Windows's system error code is cleared upon a function 
return.  This has not been the behavior for previous releases MinGW.  Below is 
a simple program that creates a directory.  If you run it twice (or create 
c:\temp\zomg prior to running) it should exit with a return code of 183.  Using 
Ruben's latest mingw-w32 with gcc 4.7, it exits with 0, since the error code is 
cleared upon returning from the function create.  If you move the code in that 
function to "main" everything works as intended.

Is this going to be the way gcc 4.7 works (I know the return semantics have 
changed slightly)?  Or is this a problem with the current state of mingw-w32 
and/or Ruben's build?  As far as I know, Ruben's build is the only functioning 
win32 host build for mingw-w32  w/ gcc 4.7 (the CRT bundled with the automated 
builds is missing symbols). 

[code]
#include <Windows.h>
    
#include <iostream>
using namespace std;

void create(const char* name) {
    SECURITY_DESCRIPTOR sd;
    InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
    SetSecurityDescriptorDacl(&sd, true, 0, false);
    SECURITY_ATTRIBUTES sa;
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor = &sd;
    sa.bInheritHandle = false;
    
   int val = CreateDirectoryA(name, &sa);
}

int main() {
    const char* name = "C:\\Temp\\zomg";
    create(name);
    return GetLastError();
}
[/code]

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to