For Windows I have successfully used the information/code found here http://msdn.microsoft.com/en-us/magazine/cc301808.aspx

For Linux I don't know but from googling and getting this page http://www.linuxquestions.org/questi...ary-so-438693/ I would start by reading the source for nm, readelf & objdump