autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoconf tests and stdcall name mangling


From: Nick Bowler
Subject: Re: autoconf tests and stdcall name mangling
Date: Wed, 22 May 2013 16:06:05 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hello,

On 2013-05-22 20:22 +0200, Dimitrios Apostolou wrote:
> The "getaddrinfo-link.c" attached file is a simplification of what 
> AC_REPLACE_FUNCS(getaddrinfo) tries to compile and link. It fails to find 
> the symbol because gcc most probably doesn't use proper calling 
> conventions (stdcall). This is demonstrated by the build success of the 
> second attached program. So:
[...]
> In the second case ("getaddrinfo-link-2.c") compilation is successful 
> because the symbol linked is "address@hidden" which actually exists in 
> ws2_32 (verified it with nm).
[...]
> [getaddrinfo-link-2.c]
> int __attribute__((__stdcall__)) getaddrinfo(int,int,int,int);
[...]

The fundamental problem, I think, is that you really need the proper
headers included and AC_REPLACE_FUNCS does not seem to allow you to
specify the includes.  So you probably can't use this macro at all.

You can use AC_LINK_IFELSE to fully specify the test program to compile
and link, which is probably what you'll need to do here.  This may still
be tricky to get right.  Alternately, Gnulib[1] has a getaddrinfo module[2]
which may already do everything you need (although I have not used it).

 [1] https://gnu.org/s/gnulib
 [2] 
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=modules/getaddrinfo

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



reply via email to

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