提交 9af7ca10 编写于 作者: K Kevin Pyle

Mark library functions as "C" linkage

The documentation disclaims support for building with a C++ compiler, so
it is reasonable to assume that the library will be built with a plain C
compiler, so the functions will all have plain C linkage.  By default, a
C++ application that wished to use libiniparser would need to wrap the
inclusion of libiniparser headers in 'extern "C" { ... }' to reflect the
C linkage of libiniparser.  Instead, place that marker directly in the
libiniparser headers, so that client applications do not need to care.
This has no effect on normal compilation of libiniparser, since the new
markers are inside a '#ifdef __cplusplus' guard, and straight C
compilers do not define __cplusplus.
上级 7374cab6
......@@ -23,6 +23,10 @@
#include <string.h>
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
New types
---------------------------------------------------------------------------*/
......@@ -162,4 +166,8 @@ void dictionary_unset(dictionary * d, const char * key);
/*--------------------------------------------------------------------------*/
void dictionary_dump(dictionary * d, FILE * out);
#ifdef __cplusplus
}
#endif
#endif
......@@ -27,6 +27,10 @@
#include "dictionary.h"
#ifdef __cplusplus
extern "C" {
#endif
/*-------------------------------------------------------------------------*/
/**
@brief Get number of sections in a dictionary
......@@ -304,4 +308,8 @@ dictionary * iniparser_load(const char * ininame);
/*--------------------------------------------------------------------------*/
void iniparser_freedict(dictionary * d);
#ifdef __cplusplus
}
#endif
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册