*param_dup() & C++

2004-11-22 Thread J.T. Conklin
The TAO SSLIOP implementation uses openssl, but does not compile with
some C++ compilers (including current versions of g++) due to what
appears to be problems with the DSAparams_dup() and DHparams_dup()
macros.  

This bit of code is similar to that in TAO's SSLIOP_EVP_PKEY.cpp.  It
compiles fine with gcc, but fails with with g++.  I'm using gcc 3.3.3
and openssl 0.9.7d as distributed with NetBSD 2.0RC4 and gcc 3.3 and
openssl 0.9.7b as distributed with MacOSX 10.3.6 "Panther".  I've also
reproduced the same problem with gcc 3.4.2.

Compiling this code:
#include 
#include 
#include 


DSA *
duplicate_dsa(DSA *dsa)
{
return DSAparams_dup (dsa);
}

DH *
duplicate_dh(DH *dh)
{
return DHparams_dup (dh);
}

Yields:
$ g++ -O2 -c ssl.cc 
ssl.cc: In function `DSA* duplicate_dsa(DSA*)':
ssl.cc:9: error: invalid conversion from `int (*)()' to `int (*)(...)'
ssl.cc:9: error: invalid conversion from `char*(*)()' to `char*(*)(...)'
ssl.cc: In function `DH* duplicate_dh(DH*)':
ssl.cc:15: error: invalid conversion from `int (*)()' to `int (*)(...)'
ssl.cc:15: error: invalid conversion from `char*(*)()' to `char*(*)(...)'

I'm not quite sure whether it's TAO, g++, or openssl that's at fault,
but I'd appreciate any pointers.

--jtc

-- 
J.T. Conklin
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: *param_dup() & C++

2004-11-23 Thread Dr. Stephen Henson
On Mon, Nov 22, 2004, J.T. Conklin wrote:

> The TAO SSLIOP implementation uses openssl, but does not compile with
> some C++ compilers (including current versions of g++) due to what
> appears to be problems with the DSAparams_dup() and DHparams_dup()
> macros.  
> 
> This bit of code is similar to that in TAO's SSLIOP_EVP_PKEY.cpp.  It
> compiles fine with gcc, but fails with with g++.  I'm using gcc 3.3.3
> and openssl 0.9.7d as distributed with NetBSD 2.0RC4 and gcc 3.3 and
> openssl 0.9.7b as distributed with MacOSX 10.3.6 "Panther".  I've also
> reproduced the same problem with gcc 3.4.2.
> 
> Compiling this code:
> #include 
> #include 
> #include 
> 
> 
> DSA *
> duplicate_dsa(DSA *dsa)
> {
> return DSAparams_dup (dsa);
> }
> 
> DH *
> duplicate_dh(DH *dh)
> {
> return DHparams_dup (dh);
> }
> 
> Yields:
> $ g++ -O2 -c ssl.cc 
> ssl.cc: In function `DSA* duplicate_dsa(DSA*)':
> ssl.cc:9: error: invalid conversion from `int (*)()' to `int (*)(...)'
> ssl.cc:9: error: invalid conversion from `char*(*)()' to `char*(*)(...)'
> ssl.cc: In function `DH* duplicate_dh(DH*)':
> ssl.cc:15: error: invalid conversion from `int (*)()' to `int (*)(...)'
> ssl.cc:15: error: invalid conversion from `char*(*)()' to `char*(*)(...)'
> 
> I'm not quite sure whether it's TAO, g++, or openssl that's at fault,
> but I'd appreciate any pointers.
> 

The problem is that *_dup() are all macros and there's a conflict between the
C definition of func() (undefined parameters) and the C++ version (no
parameters).

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: *param_dup() & C++

2004-11-23 Thread J.T. Conklin
"Dr. Stephen Henson" <[EMAIL PROTECTED]> writes:
>> I'm not quite sure whether it's TAO, g++, or openssl that's at fault,
>> but I'd appreciate any pointers.
>> 
>
> The problem is that *_dup() are all macros and there's a conflict
> between the C definition of func() (undefined parameters) and the
> C++ version (no parameters).

While it would be useful if openssl was changed so that the entire API
could be used by both C++ and C, I'll need to add a workaround for TAO
anyway so it will work with older versions of openssl.

I think I can workaround this by having C-language functions that wrap
the *_dup() macros which are called by the C++ method.

Thanks.  

--jtc

-- 
J.T. Conklin
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]