Hi Stuart,
thanks for the hint, I made one further step.
Stuart Henderson wrote:
You must use libbind's headers, too: -I/usr/local/include/libbind
Just for the record, it is not -I/usr/local/include/libbind but
-I/usr/local/include/bind
This works fine with my example test program, but my full program I want
to port fails miserably:
#0 0x0900cbf2 in __atexit_register_cleanup (func=0x8ff2ef0 <_cleanup>)
at /usr/src/lib/libc/stdlib/atexit.c:181
#1 0x0900cb58 in __smakebuf (fp=0x28f98f40) at
/usr/src/lib/libc/stdio/makebuf.c:68
#2 0x0900a8bb in __srefill (fp=0x28f98f40) at
/usr/src/lib/libc/stdio/refill.c:98
#3 0x08fda15d in fgets (buf=0xcfbf2578 "È)¿Ïï)ÿ\bÁ\035÷(.", n=1023,
fp=0x28f98f40) at /usr/src/lib/libc/stdio/fgets.c:66
#4 0x0a114190 in __res_vinit () from /usr/local/lib/libbind/libbind.so.3.0
#5 0x0a10e747 in __res_init () from /usr/local/lib/libbind/libbind.so.3.0
#6 0x0ba84ed5 in -[CWDNSManager(Private) _parseResolvFile]
(self=0x863bec50, _cmd=0x2ba71030) at CWDNSManager.m:463
The error however seems to come from libbind itself, inside __res_init.
I wonder however why the small example works, which was extracted.
res_init() has no parametrers.
It would probably make sense to apply the diff suggested in that thread
though, as it fixes this case and I don't see a downside (it isn't enough
for some programs which grovel deeper in struct _res, e.g. mtr, but it
seems it fixes enough common cases to be useful).
Here's a complete diff including tedu's suggestion.
I suppose you intend to patch libc to handle this simple case without
resorting to libbind?
Riccardo