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

[Freeciv-Dev] (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] (PR#2102) default user name "name"
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Tue, 23 Mar 2004 16:47:31 -0800
Reply-to: rt@xxxxxxxxxxx

<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?

-James Canete


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