Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Fix WiFiEventHandlerOpaque, now implemented correctly in header and i…

Open EliaTomaselli opened this issue 3 years ago • 2 comments

I was trying out the library and noticed that when calling

WiFiEventHandler handler = WiFi.onStationModeConnected( [](WiFiEventStationModeConnected e) { ... });

the variable "handler" (which is typedef'd as a std::shared_ptr<WiFiEventHandlerOpaque>) was basically a shared pointer with an empty struct inside, since WiFiEventHandlerOpaque in ESP8266WiFiGeneric.h was just declared like this.

struct WiFiEventHandlerOpaque;

This leads to a "pointer to incomplete class type is not allowed" compile time error, because the interface is missing and no method or member variable can be accessed from "handler".

EliaTomaselli avatar Jan 28 '22 16:01 EliaTomaselli

What is the exact error message you are seeing, and what is the example code that triggers the error? We are allowed to return the pointer, but yes we can't access it's members from user code as it is only available from inside of ESP8266WiFiGeneric.cpp

mcspr avatar Jan 28 '22 17:01 mcspr

ping

mcspr avatar Feb 20 '22 13:02 mcspr