[Top][All Lists]

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

Checking for PASCAL decl funcs/libs

From: Dizzy
Subject: Checking for PASCAL decl funcs/libs
Date: Sat, 21 Jan 2006 14:35:15 +0200
User-agent: KMail/1.9


I am trying to tune one autoconf at a project I work on to be able to use it 
when cross-compiling with mingw on a linux box for a win32 target. I have 
problems using AC_CHECK_LIB and AC_CHECK_FUNC for libraries and functions. 
From what I have debugged so far the problem seems to be that the functions 
in the mingw provided "win32 runtime" are declared with "PASCAL" declaration 
style and as such they mangle differently for linking than the C ones. So 
AC_CHECK_LIB and AC_CHECK_FUNC both do dummy C declarations for the functions 
looked up and the program obviously doesnt link. I had to use AC_LINK_IFELSE 
with my own source to have the tested source include a proper header (that 
does the proper PASCAL declarations) instead of generating the dummy C 
declaration like in:

AC_MSG_CHECKING([for select in -lws2_32])
LIBS="$LIBS -lws2_32"
        [AC_LANG_PROGRAM([[#include <winsock2.h>]],[[select(0,0,0,0,0);]])], 
        AC_MSG_RESULT( [yes] ) , 
        [ LIBS=$save_libs; AC_MSG_RESULT( [no] ) ] )

I supose I could make a AC macro for this library check and one similar for 
the AC_CHECK_FUNC equivalent.

One problem with the AC_CHECK_FUNC version whould be that I want the same 
autoconf script to work both in POSIX enviroments (having "select" with a C 
declaration) and the mingw win32 cross compile enviroment (declaring "select" 
in a header PASCAL like) and to solve it I whould need first to check for the 
headers (if the enviroment provides something like "winsock2.h") then the 
source I use to check for the function should do 
# include <winsock2.h>

All this sounds very hackish to me (I dont expect to be able to #ifdef for the 
config.h defined macros while running configure heh), I supose there is a 
cleaner solution so please help, thank you!

Mihai RUSU                                      Email: address@hidden
GPG :      WWW:
                        "Linux is obsolete" -- AST

reply via email to

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