Operating System - HP-UX
1833752 Members
2897 Online
110063 Solutions
New Discussion

Difference in nm -x output and function pointer output.

 
Satheesh_2
New Member

Difference in nm -x output and function pointer output.

All,

I have a query related to a C program running under HP.
Take a look at the following program.
===========================
#include
unsigned int func(char *s);
main()
{
printf("%x\n",func);
}
unsigned int func(char *s)
{
printf("In func:%s \n",s);
}
===========================
Executing the above code gives me
address of function func.
I can get the same by using nm also.
nm -x a.out | grep func.
But output I get from a.out and from
nm is different. Why is it so.
On Solaris, I get same values in both the cases.
With the ouput I get from nm, I cant
use the value to call that function
using function pointer.
How can I resolve this.
Sharing the expertise leads to obvious solution for most of the problems.