libgpg-error in C++ code
Ralf Schneider
ralf@tapfere-schneiderleins.de
Wed, 16 Jul 2003 08:06:11 +0200
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've encoutered some problems when using libgcrypt from within C++ code. Th=
e=20
problem is located in libgpg-error in gpg-error.h. The functions gpg_err_co=
de=20
and gpg_err_source have a return value of an enum type but they return an=20
integer. The compiler (gcc 3.2) complains:
gpg-error.h: In function `gpg_err_code_t gpg_err_code(unsigned int)':
gpg-error.h:464: invalid conversion from `unsigned int' to `gpg_err_code_t'
I think the problem is the different representation of enums in C and C++. =
The=20
problem could be solved by inserting en explicit cast to the enum type. For=
=20
example:
static __inline__ gpg_err_code_t
gpg_err_code (gpg_error_t err)
{
return (gpg_err_code_t)(err & GPG_ERR_CODE_MASK);
}
It would be great if one of the developers of libgpg-error could fix this,=
=20
because at the moment I've to modifiy the include file, which is not really=
a=20
good solution :-)
Best regards,
Ralf.
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/FOtX7YyyfykA0YkRApSYAJ9xqbPlh1J0+c0/VFn0F0T3VqCf0ACfTqYh
mlwataCWj+Zy+d2Y3OSW8+Q=3D
=3DZ7CD
=2D----END PGP SIGNATURE-----