Skip to Content.
Sympa Menu

freetds - Re: [freetds] Win32 Make

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Win32 Make
  • Date: Thu, 30 Jul 2015 21:03:19 -0500


> On Jul 30, 2015, at 1:23 PM, Frediano Ziglio <freddy77 AT gmail.com> wrote:
>
> 2015-07-30 15:26 GMT+01:00 Michael Becker <m.becker AT spider-software.net>:
>> these functions must be checked using check_symbol_exists
>>
>> I have changed CMakeLists.txt as follows:
>>
>> ==============================================
>> # find functions
>> set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
>> set(FUNCS _atoi64 strtok_r readpassphrase
>> strlcpy strlcat basename getopt strsep gettimeofday
>> nl_langinfo locale_charset setenv putenv
>> getuid getpwuid getpwuid_r fstat alarm fork
>> gethrtime localtime_r setitimer
>> _fseeki64 _ftelli64 setrlimit
>> inet_ntoa_r getipnodebyaddr getipnodebyname
>> getaddrinfo inet_ntop gethostname poll socketpair
>> clock_gettime fseeko pthread_cond_timedwait
>> pthread_condattr_setclock _lock_file _unlock_file usleep nanosleep
>> readdir_r)
>>
>> foreach(func ${FUNCS})
>> string(TOUPPER "HAVE_${func}" var)
>> check_function_exists(${func} ${var})
>> set(HAVE_GETADDRINFO 1 CACHE INTERNAL "")
>> config_write("/* Define to 1 if you have function <${func}>. */\n")
>> config_write("#cmakedefine ${var} 1\n\n")
>> endforeach(func)
>>
>> set(VSPRINTF asprintf vasprintf vsnprintf _vsnprintf snprintf _snprintf
>> _vscprintf)
>>
>> foreach(func ${VSPRINTF})
>> string(TOUPPER "HAVE_${func}" var)
>> check_symbol_exists(${func} stdio.h ${var})
>> config_write("/* Define to 1 if you have function <${func}>. */\n")
>> config_write("#cmakedefine ${var} 1\n\n")
>> endforeach(func)
>>
>> set(CMAKE_REQUIRED_LIBRARIES)
>> ==============================================
>>
>
> Change a bit to do both the tests, it continues to build on old Visual
> Studio versions.
>
>> This works for the replacement functions but runs into an error when
>> linking
>> tdsodbc.dll because some stdio functions seem to have moved to
>> legacy_stdio_definitions.lib

Assuming we are still talking about the printf/scanf family of functions,
according to:

<https://msdn.microsoft.com/en-us/library/bb531344.aspx#BK_CRT>

you should get the inline functions and no link errors if you are including
the correct headers. This is the recommended solution. Only if you are
unable or unwilling to include the necessary headers would you need to link
against legacy_stdio_definitions.lib.

I don’t know how check_function_exists in the code quoted above works. If
it’s just looking for a symbol in a library, that’s not really adequate to
determine what the compiler will see.

>>
>
> Which functions?
>
>> How can this lib be included optional into cmake?
>>
>
> I think just include in lib_BASE define but perhaps would be better to
> avoid to use them. Depends on the functions.

________________________________________
Craig A. Berry
mailto:craigberry AT mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser





Archive powered by MHonArc 2.6.24.

Top of Page