Back to Ponyc

pony_asio_event_resubscribe* must be declared in event.h for C linkage on Windows

.known-couplings/asio-resubscribe-c-linkage.md

0.66.0972 B
Original Source

pony_asio_event_resubscribe* must be declared in event.h for C linkage on Windows

The cross-backend asio re-arm functions pony_asio_event_resubscribe, pony_asio_event_resubscribe_read, and pony_asio_event_resubscribe_write are declared in src/libponyrt/asio/event.h and defined per backend (epoll.c, kqueue.c, sock_notify.c, emscripten.c); the packages/net stdlib FFI-calls them. libponyrt's .c files compile as C++ on the Windows (MSVC) build, so a definition that is not declared in a header gets a C++-mangled symbol name, and the stdlib FFI — which references the plain C name — fails to link. Add a new asio event function the stdlib calls, or drop one of these declarations from event.h, and the Windows link breaks while POSIX stays green (POSIX compiles .c as C and never mangles). Run on a Windows host: make test builds the stdlib against libponyrt; an undeclared definition surfaces there as an unresolved-symbol link error.