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

Remove static qualifiers to support wrapping in other languages #165

Open
nordlow opened this issue Apr 21, 2024 · 5 comments
Open

Remove static qualifiers to support wrapping in other languages #165

nordlow opened this issue Apr 21, 2024 · 5 comments

Comments

@nordlow
Copy link

nordlow commented Apr 21, 2024

I'm currently developing a wrapper for yyjson in D.

However the inline qualifier macro(s) on some API functions prevents them from being callable as an extern(C) functions. Would it possible to remove the static qualifer part in those macros?

@TkTech
Copy link
Contributor

TkTech commented Apr 21, 2024

No part of the public API should be marked as inline, what are you trying to wrap?

@ibireme
Copy link
Owner

ibireme commented Apr 21, 2024

Maybe you could try this:

// create a new file, e.g. yyjson_ext.c
#define yyjson_api_inline yyjson_api
#include yyjson.h

@nordlow
Copy link
Author

nordlow commented Apr 22, 2024

Search for yyjson_api_inline in yyjson.h.

@nordlow
Copy link
Author

nordlow commented Apr 22, 2024

I suggest changing

#ifndef yyjson_api_inline
#   define yyjson_api_inline static yyjson_inline
#endif

to

#ifndef yyjson_api_inline
#   define yyjson_api_inline yyjson_inline
#endif

in yyjson.h. Shall I create a PR that does this?

@ibireme
Copy link
Owner

ibireme commented Apr 22, 2024

@nordlow No, the static keyword is used to limit the scope of these functions to the current source file. If we simply remove static and make these functions inline, it could potentially lead to naming collisions and linker errors in some environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants