Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export/import symbols when building/using a shared DLL #202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions jsmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ extern "C" {

#ifdef JSMN_STATIC
#define JSMN_API static
#define JSMN_INTERNAL_API static
#elif defined(JSMN_WIN32_SHARED) && defined(_MSC_VER)
#ifdef JSMN_API_EXPORTS
#define JSMN_API __declspec(dllexport)
#else
#define JSMN_API __declspec(dllimport)
#endif
#define JSMN_INTERNAL_API extern
#else
#define JSMN_API extern
#define JSMN_INTERNAL_API extern
#endif

/**
Expand Down Expand Up @@ -265,7 +274,7 @@ static int jsmn_parse_string(jsmn_parser *parser, const char *js,
/**
* Parse JSON string and fill tokens.
*/
JSMN_API int jsmn_parse(jsmn_parser *parser, const char *js, const size_t len,
JSMN_INTERNAL_API int jsmn_parse(jsmn_parser *parser, const char *js, const size_t len,
jsmntok_t *tokens, const unsigned int num_tokens) {
int r;
int i;
Expand Down Expand Up @@ -456,7 +465,7 @@ JSMN_API int jsmn_parse(jsmn_parser *parser, const char *js, const size_t len,
* Creates a new parser based over a given buffer with an array of tokens
* available.
*/
JSMN_API void jsmn_init(jsmn_parser *parser) {
JSMN_INTERNAL_API void jsmn_init(jsmn_parser *parser) {
parser->pos = 0;
parser->toknext = 0;
parser->toksuper = -1;
Expand Down