diff --git a/Makefile b/Makefile index 51602975..f53c3139 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ mg_prefix: mongoose.c mongoose.h # C++ build test++: CLANG = g++ test++: WARN += -Wno-shadow -Wno-missing-field-initializers -Wno-deprecated -test++: unamalgamated +test++: test # Make sure we can build from an unamalgamated sources unamalgamated: $(SRCS) $(HDRS) Makefile @@ -108,7 +108,7 @@ mongoose.c: $(SRCS) Makefile (cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/private.h src/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@ mongoose.h: $(HDRS) Makefile - (cat src/license.h src/version.h ; cat src/arch.h src/arch_*.h src/config.h src/str.h src/log.h src/timer.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,')> $@ + (cat src/license.h src/version.h ; cat src/arch.h src/arch_*.h src/config.h src/str.h src/log.h src/timer.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/ws.h src/sntp.h src/mqtt.h src/dns.h | sed -e 's,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif')> $@ clean: EXAMPLE_TARGET = clean clean: ex diff --git a/mongoose.h b/mongoose.h index 97843212..54fd3fdb 100644 --- a/mongoose.h +++ b/mongoose.h @@ -17,6 +17,10 @@ #pragma once #define MG_VERSION "7.3" +#ifdef __cplusplus +extern "C" { +#endif + #define MG_ARCH_CUSTOM 0 #define MG_ARCH_UNIX 1 @@ -959,3 +963,7 @@ bool mg_dns_parse(const uint8_t *buf, size_t len, struct mg_dns_message *); size_t mg_dns_parse_rr(const uint8_t *buf, size_t len, size_t ofs, bool is_question, struct mg_dns_rr *); size_t mg_dns_decode_name(const uint8_t *, size_t, size_t, char *, size_t); + +#ifdef __cplusplus +} +#endif diff --git a/src/version.h b/src/version.h index adab36ad..15d4aac9 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,6 @@ #pragma once #define MG_VERSION "7.3" + +#ifdef __cplusplus +extern "C" { +#endif