From b6568c88dd0d988a9ae3729761c36ded38c298c6 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 30 Jun 2022 01:34:41 +0200 Subject: [PATCH] Add strange linker hack to fix asio --- CMakeLists.txt | 1 + src/linker_hacks.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/linker_hacks.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7af2acb..53b3c49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ set(headers set(sources src/espstrutils.cpp + src/linker_hacks.cpp src/schedulertask.cpp src/taskutils.cpp ) diff --git a/src/linker_hacks.cpp b/src/linker_hacks.cpp new file mode 100644 index 0000000..d44c68d --- /dev/null +++ b/src/linker_hacks.cpp @@ -0,0 +1,15 @@ +// I dont know why but without this hack here the linker +// fails for asio and I could not fix it otherwise + +extern "C" char *lwip_if_indextoname(unsigned int ifindex, char *ifname); +extern "C" unsigned int lwip_if_nametoindex(const char *ifname); + +extern "C" char *if_indextoname(unsigned int ifindex, char *ifname) +{ + return lwip_if_indextoname(ifindex, ifname); +} + +extern "C" unsigned int if_nametoindex(const char *ifname) +{ + return lwip_if_nametoindex(ifname); +}