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

Cannot link tests when building as static library #213

Closed
FSMaxB opened this issue Nov 4, 2017 · 2 comments
Closed

Cannot link tests when building as static library #213

FSMaxB opened this issue Nov 4, 2017 · 2 comments

Comments

@FSMaxB
Copy link
Collaborator

FSMaxB commented Nov 4, 2017

I noticed this while trying to implement #207.

This is most likely because common.h includes cJSON.c, but not entirely sure. But this needs to be fixed anyway.

The reason I did this is because I need a way to test cJSONs static functions in the unit tests, but they are not visible from outside of the library.

A fix would be to use a macro like cJSON_Private that can be changed to build a version of cJSON that exposes it's internals, so they can be tested.

I think it is ok to build a shared cJSON library with exposed internals like that, even if cJSON is built as a static library, because this is just for testing and won't be installed on the system.

@FSMaxB
Copy link
Collaborator Author

FSMaxB commented Nov 12, 2017

This is harder than I thought it would be.

@FSMaxB FSMaxB added this to the 1.7 milestone Nov 15, 2017
@FSMaxB
Copy link
Collaborator Author

FSMaxB commented Nov 28, 2017

This is fixed on the develop branch. Although I didn't succeed in making a CJSON_PRIVATE macro.

@FSMaxB FSMaxB closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant