Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#2102) default user name "name"
Home

[Freeciv-Dev] Re: (PR#2102) default user name "name"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: nswint@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2102) default user name "name"
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Mar 2004 17:22:18 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=2102 >

James Canete wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=2102 >
> 
>>[jdorje - Tue Mar 23 22:37:15 2004]:
>>
>>Andreas Kemnade wrote:
>>
>>
>>>>>Please look at the archive why we don't check for win32 functions.
>>>>>So the WIN32_NATIVE macro has to be used.
>>
>>>The point is you cannot check for functions of the win32 api easily
>>
>>on mingw32.
>>
>>>__stdcall is the name of the problem. You do not have a symbol
>>
>>called GetUserName somewhere but you might have GetUserName@8 if
>>GetUserName would a function (It is a macro).
>>
>>>The 8 is the number of bytes for the parameters on the stack.
>>
>>I don't think this is a problem with modern autoconfs.  The configure
>>check compiles and runs a program that is something like:
>>
>>int main()
>>{
>>   char *foo() = GetUserName;
>>
>>   return (foo != GetUserName);
>>}
>>
>>which should work on any platform I would think.
> 
> 
> I tried inserting this into configure.ac/configure.in:
> AC_CHECK_HEADERS(windows.h)
> AC_CHECK_FUNC(GetUserName)
> 
> and get this in the config.log:
> configure:17400: checking for GetUserName
> configure:17457: gcc -o conftest.exe -Wall -Wpointer-arith -Wcast-align
> -Wmissing-prototypes -Wmissing-declarations   conftest.c -lz  -lwsock32 >&5
> C:/DOCUME~1/James/LOCALS~1/Temp/cc4Caaaa.o(.text+0x24):conftest.c:
> undefined reference to `GetUserName'
> C:/DOCUME~1/James/LOCALS~1/Temp/cc4Caaaa.o(.data+0x0):conftest.c:
> undefined reference to `GetUserName'
> 
> Same result if replaced with GetUserNameA.  conftest.c is basically as
> above.  Autoconf 2.59, by the way.
> 
> Also: 
> $ objdump -x libadvapi32.a | grep GetUserName
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _LsaGetUserName@8
> [  8](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> __imp__LsaGetUserName@8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _GetUserNameW@8
> [  8](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> __imp__GetUserNameW@8
> [  7](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _GetUserNameA@8
> [  8](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000
> __imp__GetUserNameA@8
> 
> Am I doing something wrong?

Probably not, since that's exactly the error Andi reported.  This seems 
like a serious flaw in autoconf...

For now I guess we should stick to the WIN32_NATIVE macro.  Later I'd 
like to fix it or at least replace it with a properly-detected (perhaps 
according to header files only) WIN32_API macro.

jason




[Prev in Thread] Current Thread [Next in Thread]