Open marcstern opened 4 years ago
Builds fine for me with VS2019 using this PR: https://github.com/cisco/cjose/pull/119
Builds fine for me with VS2019 using this PR: #119
I don't see any fix for that problem
Actually, the problem is more general than Visual C++. We have
#ifdef __cplusplus
extern "C" {
#endif
/** The JWE algorithm header attribute name. */
extern const char *CJOSE_HDR_ALG;
In case cplusplus is defined, we have twice "extern", which poses a problem with some compilers. The second "extern", on each "const ..." line should be enclosed in "#ifndef cplusplus". This way it's compatible with all cases. Btw, Visual C++ handles thisa automatically without having to declare declspec(dllexport)/declspec(dllimport)
In header.h, globals variables are called the following way:
extern const char *CJOSE_HDR_ALG;
In Visual C++, there's no way to have that declaration included in a third-party application, even by providing a DEF file. All exported variables have to be declared with
extern __declspec(dllimport)
.Proposal, compatible with Visual C++ and others: