-
Notifications
You must be signed in to change notification settings - Fork 86
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
Make libscrypt-kdf available to C++ applications #363
Comments
I'm not a C++ expert, but I believe that the
syntax is the canonical way to include a C header in a C++ project. I think it's an entirely normal part of writing code in C++. |
Usually system libraries have these extern statements for compatibility with C++. From what I have seen, it seems more common to add these externs directly in the header file rather than requiring the application developer to add externs around the include statement. Since there are no particular downsides of having them directly in the include file but it enhances the experience for C++ developers, I guess that's why this is usually done. As one of many examples, you have GLib, which is a C library but can be used from C++ as well. See https://stackoverflow.com/questions/58665349/what-are-g-begin-decls-and-g-end-decls-for. The |
I agree that this isn't really necessary; on the other hand, since the point of scrypt-kdf.h is to make it easier for people to use this code, we might as well make it easier for people to use this code. @Emill Can you open a PR with a patch to add this? |
I included this fix in #364. |
Nice! Sorry, I didn't have time myself to file a PR. |
Added in #364; will be part of the next release. |
The scrypt-kdf.h header does not wrap the function using
extern "C"
, which leads to linking issues "undefined reference" in C++ applications. A workaround is to wrap the#include <scrypt-kdf.h>
line insideextern "C"
as explained by #224, which is a bit annoying.It would be better to do this directly inside the scrypt-kdf.h file instead.
The text was updated successfully, but these errors were encountered: