Skip to content

HTTP Server sample fails to compile for Windows x64 #1574

@hmartinez82

Description

@hmartinez82

evutil_socket_t is a long long on Windows.
The do_term function passed as a pointer then does not match the function pointer type declaration. in http-server.c

Expected

libevent builds

Actual

../libevent-2.1.12-stable/sample/http-server.c:559:9: error: incompatible function pointer types passing
      'void (int, short, void *)' to parameter of type 'event_callback_fn' (aka 'void (*)(long long, short, void *)')
      [-Wincompatible-function-pointer-types]
  559 |         term = evsignal_new(base, SIGINT, do_term, base);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libevent-2.1.12-stable/include/event2/event.h:983:44: note: expanded from macro 'evsignal_new'
  983 |         event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
      |                                                   ^~~~
../libevent-2.1.12-stable/include/event2/event.h:1090:87: note: passing argument to parameter here
 1090 | struct event *event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
      |                                                                                       ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions