- dowload build source from apple: https://opensource.apple.com/tarballs/mDNSResponder/
- extract and edit some file:
- File Client/dns-sd.c : insert
#include <stdarg.h>
#define MIN(X, Y) (X < Y ? X : Y)
- File Client/dns-sd.c : insert
- for build source code in my computer
ubuntu 20.04
, enter mDNSPosix folder, runmake os=linux
- and finally run
make install
to use mDNSResponder
in your source code, you must link object file with -ldns_sd
flag
// test.cc
#include <dns_sd.h>
int main() {
DNSServiceRef sdRef;
DNSServiceRegister(&sdRef, 0, 0, "gialuong", "_http._tcp", "local.", NULL, 1, NULL, NULL, NULL);
while (1);
return 0;
}
g++ -o test test.cc -ldns_sd