Abdelrazak Younes wrote:
> Bo Peng wrote:
>>> I will change scons using this logic.
>>
>> Done fr scons: iconv is required, and ICONV_CONST is also defined in
>> common/config.h.
> 
> Hum, it does not work here Bo. common/config.h has:
> 
> /* Define as const if the declaration of iconv() needs const. */
> #define ICONV_CONST
> 
> And we need "#define ICONV_CONST const" on win32. But the test seems to
> pass correctly:
> 
> Check if the declaration of iconv needs const... yes
> 
> Abdel.
> 
> 

I've wondered about the const test:

def checkIconvConst(conf):
    ''' check the declaration of iconv '''
    check_iconv_const = '''
#include <stdlib.h>
#include <iconv.h>

extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
#ifndef LIBICONV_DLL_EXPORTED
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, 
size_t *outbytesleft);
#endif
#else
size_t iconv();
#endif

int main()
{
    return 1;
}
'''

How does it work? Scons only tries to compile the code to see if there is a 
const second parameter?

I can't see how compiling could fail, declaring iconv(...) is in all cases 
possible, even when not
including iconv.h.

In cmake I declare iconv without a non const second parameter (linux version) 
and a different
return type, then compiling will fail on linux because overloading of the 
return type is not possible.
But it compiles on windows because there is no iconv(..) with a non const 
second parameter.

Peter

Reply via email to