Use const pointers everywhere.
That was the original plan, but you can't assign char** to char const**
under C typing. I decided it's better to just keep them char** to avoid
having to either type cast the pointers in function arguments, or having
to rewrite surrounding typing.
Two of these:
+ return -1l;
Neither of those functions return long int. Use plain -1.
The one in dwarf_getpubnames is there because other return statements do
that, too, in the same function. The function returns ptrdiff_t -- that
does have a size of long, doesn't it?