I did a bit of reading and may have found the reason for the compiler error.

I am using g++ 4.1.2.

In c++ string literals are defined as const char* and c defines them
as char *.  The c++ standard allows implicit casts from const char* to
char* for backward compatibility reasons with ANSI c.

The BIO_set_nbio_accept macro defines a string literal "a" as the
fourth argument to BIO_ctrl.  The function definition for BIO_ctrl
defines the fourth input argument to be void*.  Thus the string
literal when compiling via g++ is implicitly converted from const
char* to const void*, but implicit const conversions to non const
conversions (besides the const char* case) is forbidden.  Hence the
compiler error outlined below. An explicit cast is needed.

I tried this theory out by creating my own version of the macro
explicitly casting the string literal to a void* and it worked fine.

Is there a better way of fixing this problem?  Has anyone used the
macro with a c++ compiler and run into similar problems?

Cheers,

-Domingo

On 6/18/09, Domingo Kiser <domingo.ki...@gmail.com> wrote:
> Does anyone have an answer to the following post from 2003?
>
> http://marc.info/?l=openssl-dev&m=104635293932621&w=2
>
>
> List:       openssl-dev
> Subject:    BIO_set_nbio_accept
> From:       "p b" <phbgt () wanadoo ! fr>
> Date:       2003-02-27 13:34:53
> [Download message RAW]
>
>
> I use openssl openssl-0.9.7-stable-SNAP-20030226.tar.gz , with linux
> Mandrake 9.0
>
> When I compile the BIO_set_nbio_accept(BIO*,int)
>
> I get the message :
> Error : Invalid conversion from 'const void*' to 'void *'
>
>
> If I use the function :
> BIO_ctrl(bio,BIO_C_SET_ACCEPT,1,0) , there's no problem,
>
> If I use the function :
> BIO_ctrl(bio,BIO_C_SET_ACCEPT,1,"a") , I get the same error,
>
>
> I think there a problem in the macro
> BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCPET,1,(n)?"a":NULL)
>
>
> Thanks
>
>
>
>
>
>
> I just ran into the same problem.
>
> --Domingo
>

-- 
Sent from my mobile device
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to