0

I'm writing embedded C software for a system that does not run on an OS. I want to be able to use netdb.h's gethostbyname() function. It is my understanding that whatever library it is part of is included in the Linux OS. Is it possible to include that library into my project? Or is it dependent on the OS?

If I can include it, where can I get the complete library?

Kara
  • 6,115
  • 16
  • 50
  • 57
user1172282
  • 527
  • 1
  • 9
  • 19
  • You can get the complete library from [the source](https://www.kernel.org/). – brice Jun 25 '13 at 16:06
  • 1
    So what network stack are you using? – Clifford Jun 25 '13 at 18:01
  • gethostbyname() is non-trivial, you will need a lot of OS replacement infrastructure. do you really need gethostbyname()? Can you do without initially and find out what other issues you will have? look for lwip (light weight ip) a bare metal network stack that might be useful for replacing what you are using. – old_timer Jun 25 '13 at 21:14

1 Answers1

1

gethostbyname() is a POSIX API function originally from BSD Sockets. If you have no OS, you will need a stand-alone network stack. Many will have similar or identical interfaces to BSD making porting code simpler, but some (especially those that need no OS or RTOS) will be designed to run on very resource constrained systems and may be rather minimal, and have a different API.

Clifford
  • 88,407
  • 13
  • 85
  • 165