How to find Dependent libraries in ELF file?

thanks for your replay,

yes you are right the the ldd tool lists the dependent shared libraries that the executable requires, along with their paths if found.

But i want to write an application which shoud do the same functionality.
Please suggest me how to interprete the ELF file to collect the information.
i need exactly as LDD tool.