mjansson / mdns

Public domain mDNS/DNS-SD library in C
The Unlicense
459 stars 120 forks source link

fix(build): fix errors when include by cpp file. #18

Closed summershrimp closed 4 years ago

summershrimp commented 4 years ago

C++ has more strict type conversion check. It still compatible with C.

mjansson commented 4 years ago

I think it would be easier with a

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif

block instead of c++-ifying the entire file.

summershrimp commented 4 years ago

Nope, extern "C" { } block cannot handle all the difference between C and CPP. You can try

extern "C" {
#include “mdns.h”
}

in a cpp file, still a lot of compiler errors.

mjansson commented 4 years ago

Fair enough, I'm not a huge fan of c++-ifying c code, but I can see the use here in a header-only case :)