Fix CheckFunctionExistsEx() cmake macro on win32

For example under mingw64 it could not detect that strtok_r() exists,
because it checks with:
  void *p = func_name;

And for this you need the function to be defined, so just sync our
CheckFunctionExistsEx.c with CheckFunctionExists.c from cmake (and later
we should drop them out) since it does correct things to detech
functions existence.

Also for WIN32 there is -FIwinsock2.h -FIws2tcpip.h, and I guess that is
not works for mingw gcc (since -F in gcc is framework, and in windows
-FI is like -include in gcc). But looks like we do not need them
already (due to fixed CheckFunctionExistsEx()).

Refs: #605
This commit is contained in:
Azat Khuzhin 2018-04-23 01:50:55 +03:00
parent d1c8993c3c
commit accf383e04

View File

@ -1,30 +1,28 @@
#ifdef CHECK_FUNCTION_EXISTS
#ifndef _WIN32
char CHECK_FUNCTION_EXISTS();
#ifdef __cplusplus
extern "C"
#endif
char
CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__
int main(){
int main()
{
int ac;
char*av[];
char* av[];
#else
int main(int ac, char*av[]){
int main(int ac, char* av[])
{
#endif
#ifdef _WIN32
void * p = &CHECK_FUNCTION_EXISTS;
#else
CHECK_FUNCTION_EXISTS();
#endif
if(ac > 1000)
{
if (ac > 1000) {
return *av[0];
}
}
return 0;
}
#else /* CHECK_FUNCTION_EXISTS */
#else /* CHECK_FUNCTION_EXISTS */
# error "CHECK_FUNCTION_EXISTS has to specify the function"
#error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */