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

Not callable from C++ without wrappers #10

Open
titinko opened this issue Sep 30, 2021 · 0 comments
Open

Not callable from C++ without wrappers #10

titinko opened this issue Sep 30, 2021 · 0 comments

Comments

@titinko
Copy link

titinko commented Sep 30, 2021

I tried to use this library from C++ and ended up needing to add an extern "C" wrapper around the method headers in pyin.h to make it callable by C++. These wrappers could be built into pyin.h to make things easier on the next C++ coder who uses this library:

#ifdef __cplusplus
extern "C" {
#endif

// The method headers that need to be wrapped.
pyin_config pyin_init(int nhop);
int pyin_trange(int nq, FP_TYPE fmin, FP_TYPE fmax);
FP_TYPE* pyin_analyze(pyin_config param, FP_TYPE* x, int nx, FP_TYPE fs, int* nfrm);

#ifdef __cplusplus
}
#endif

See https://stackoverflow.com/questions/1041866/what-is-the-effect-of-extern-c-in-c for more context on this issue.

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

1 participant