Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS Code (getHostByName and associated functions) not stripped from projects not using DNS #30

Open
jdccdevel opened this issue Dec 7, 2018 · 0 comments

Comments

@jdccdevel
Copy link

Sketches that don't need DNS (For reference, I'll refer to the examples included with nick gammon's HTTPServer Library here: https://github.com/nickgammon/HTTPserver) include a compiled copy of getHostByName() and (as far as I can tell) all associated DNS lookup code when it is completely unnecessary. (i.e. Never used, referenced, and a DNS Server never defined.)

Using #ifdef to remove EthernetUDP::beginPacket(const char*, uint16_t) and EthernetClient::connect(const char*, uint16_t), and associated templates in UDP.h and Client.h is sufficient to ensure that getHostByName, and associated DNS Code is not linked in to the sketch.

Using the Arduino IDE version 1.8.7, For the Process_POST_arguments example in the library linked above, Not linking in this unneeded code saves me 3508 bytes on my compiled sketch.

I'm not sure why these (completely unused) convenience functions are not being stripped by the linker, but they are not. I would be happy to help by testing patches, etc, but I don't know enough about the linker to be of much help.

For anyone writing a project with a Web-server, which doesn't use DNS, those extra bytes would make a big difference. (3500 bytes is 12% of the program space in a Arduino Leonardo, for example.)

I know fixing this may involve a API change, but having the DNS code there for projects that don't need it is a Huge waste of program space.

Thank you for all your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant