help porting ld preload bind ip address

Could you help me compiling this file on FreeBSD?
http://www.ryde.net/code/bind.c.txt

I need it to bind an application to a specific virtual ip address
example:
Code:
BIND_ADDR="192.168.13.40" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
BIND_ADDR="192.168.13.41" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
BIND_ADDR="192.168.13.42" LD_PRELOAD=./bind.so MYPROGRAM destination-ip
anyone who can help me compiling this file on FreeBSD 11?
Thanks
 
On Linux the command to compile it is: gcc -nostartfiles -fpic -shared bind.c -o bind.so -ldl -D_GNU_SOURCE

On FreeBSD this translates to: cc -nostartfiles -fpic -shared bind.c -o bind.so
 
Back
Top