Mailing List Archive

libgpg-error in C++ code
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I've encoutered some problems when using libgcrypt from within C++ code. The
problem is located in libgpg-error in gpg-error.h. The functions gpg_err_code
and gpg_err_source have a return value of an enum type but they return an
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
problem could be solved by inserting en explicit cast to the enum type. For
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,
because at the moment I've to modifiy the include file, which is not really a
good solution :-)

Best regards,
Ralf.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/FOtX7YyyfykA0YkRApSYAJ9xqbPlh1J0+c0/VFn0F0T3VqCf0ACfTqYh
mlwataCWj+Zy+d2Y3OSW8+Q=
=Z7CD
-----END PGP SIGNATURE-----
Re: libgpg-error in C++ code [ In reply to ]
Thanks, I have commited this patch.

moritz
--
((gpg-key-id . "6F984199")
(email . "moritz@duesseldorf.ccc.de")
(webpage . "http://duesseldorf.ccc.de/~moritz/"))