Skip to content

ArduinoOTA undefined reference (MDNS) when compiling with -DNO_GLOBAL_INSTANCES #4643

Closed
@everslick

Description

@everslick

The ArduinoOTA library has an hidden dependency on mDNS. When we have NO_GLOBAL_INSTANCES defined there will be no global object with the name MDNS and the compile fails.

IMHO the two libraries should work independently. I suspect just removing the MDNS call from ArduinoOTA will be met with some resistance, though.

I don't know how this could be easily fixed, besides removing the

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)

guard in ESP8266mDNS.h, which is a bit ironic, because I was the one proposing it in the first place. And for the sake of RAM usage, I still think it is a good thing to be be able to start services on demand, instead of creating a bunch of global objects regardless of if they are needed.

On ESP32 the MDNS object is also global, but at least there is a MDNS.end() method to shut the server and free all allocated memory.

Any opinions on that?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions