Bugs item #2506829, was opened at 2009-01-14 10:48
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2506829&group_id=2435
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: w32api
Group: Waiting User Response
>Status: Closed
Resolution: Remind
Priority: 1
Private: No
Submitted By: Andrew Klinkhamer (andrew_dk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Including libntdll.a in project causes errors with sprintf
Initial Comment:
If libntdll.a is added to a project with the following code:
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <stdio.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
wchar_t str[128];
float f = 134.56;
swprintf(str, L"%f", f);
MessageBox(NULL, str, str, MB_OK);
return 0;
}
the messagebox outputs hieroglyphics. If you remove ntdll.a from the build the output is as expected.
System Configuration:
MinGW 5.1.4 on Windows XP Sp2
gcc 3.4.5
__MINGW32_VERSION 3.15.1
__W32API_VERSION 3.12 And 3.13 (I tried both)
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2009-03-18 18:52
Message:
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 30 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Keith Marshall (keithmarshall)
Date: 2009-01-14 11:53
Message:
A quick search for `ntdll.lib', on http://www.google.com/microsoft, brings
up a bunch of references to conflicts arising between functions in
ntdll.dll and msvcrt.dll. In a VC++ forum posting:
http://tinyurl.com/7ow6kf, the MS moderator says:
> you should NOT link directly to ntdll.dll in a Win 32 application.
> Use LoadLibrary to access the functions from this dll ...
Surely, the same would apply when using this library from MinGW, i.e. you
should use LoadLibrary() rather than linking with libntdll.a? My guess is
that ntdll.dll exports an implementation for swprintf(), which is not
consistent with the prototype in scope from stdio.h, (and that prototype is
correct, for the msvcrt.dll implementation, which you get when you omit
libntdll.a).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2506829&group_id=2435
|