title: Invalid function parameter
body: <p>I 'm writing a C-Code in which i use sockets. I use this on windows and on linux, so i try to write it dynamicly. I wrote two functions to get a server/client-socket. There i have an error on compiling:</p>
  
  <pre><code>debian:~/cross_socket# make
  gcc *.c -Wall
  i586-mingw32msvc-gcc *.c -Wall -lws2_32
  socket.c: In function 'get_client_socket':
  socket.c:28: warning: passing argument 3 of 'get_socket' from incompatible pointer type
  socket.c:13: note: expected 'int (*)(SOCKET,  const struct sockaddr *, int)' but argument is of type 'int (*)(SOCKET,  const struct sockaddr *, int)'
  socket.c: In function 'get_server_socket_addr':
  socket.c:43: warning: passing argument 3 of 'get_socket' from incompatible pointer type
  socket.c:13: note: expected 'int (*)(SOCKET,  const struct sockaddr *, int)' but argument is of type 'int (*)(SOCKET,  const struct sockaddr *, int)'
  </code></pre>
  
  <p>gcc for my local system works great, but if i use mingw i get this error?!?
  It says:
  I use <code>int (*)(SOCKET,  const struct sockaddr *, int)</code> instead of <code>int (*)(SOCKET,  const struct sockaddr *, int)</code>... ?</p>
  
  <p>Here the relevant code:</p>
  
  <pre><code>inline SOCKET get_socket(uint16_t port, in_addr_t socket_in_addr, int (*create)(SOCKET, 
  const struct sockaddr*, socklen_t)) {
          SOCKADDR_IN addr;
          SOCKET result_socket = GET_SOCKET;
          if (SOCKET_NOK(result_socket))
                  return SOCKET_INIT_ERROR;
          memset(&amp;addr, 0, sizeof(SOCKADDR_IN));
          addr.sin_family = AF_INET;
          addr.sin_port = htons(port);
          addr.sin_addr.s_addr = socket_in_addr;
          if (CONNECT_NOK(create(result_socket, (SOCKADDR*)&amp;addr, sizeof(SOCKADDR))))
                  return SOCKET_INIT_ERROR;
          return result_socket;
  }
  
  SOCKET get_client_socket(char* target, uint16_t port) {
          return get_socket(port, inet_addr(target), &amp;connect);
  /*      SOCKADDR_IN addr;
          SOCKET client_socket = GET_SOCKET;
          if (SOCKET_NOK(client_socket))
                  return SOCKET_INIT_ERROR;
          memset(&amp;addr,0,sizeof(SOCKADDR_IN));
          addr.sin_family = AF_INET;
          addr.sin_port = htons(port);
          addr.sin_addr.s_addr = inet_addr(target);
          if (CONNECT_NOK(connect(client_socket, (SOCKADDR*)&amp;addr, sizeof(SOCKADDR))))
                  return SOCKET_INIT_ERROR;
          return client_socket;*/
  }
  
  SOCKET get_server_socket_addr(uint16_t port, in_addr_t socket_in_addr) {
          return get_socket(port, socket_in_addr, &amp;bind);
  /*      SOCKADDR_IN addr;
          SOCKET server_socket = GET_SOCKET;
          if (SOCKET_NOK(server_socket))
                  return SOCKET_INIT_ERROR;
          memset(&amp;addr, 0, sizeof(SOCKADDR_IN));
          addr.sin_family = AF_INET;
          addr.sin_port = htons(port);
          addr.sin_addr.s_addr = socket_in_addr;
          if (CONNECT_NOK(bind(server_socket, (SOCKADDR*)&amp;addr, sizeof(SOCKADDR_IN))))
                  return SOCKET_INIT_ERROR;
          return server_socket;*/
  }
  </code></pre>
  
  <p>Has anyone an idea?</p>