[Botan-devel] Ambiguity between unsigned int *() and const unsigned int *()

topmop topmop at gmail.com
Mon Jun 11 20:22:27 EDT 2007


Hello jack

Thanks for your time.

On 6/12/07, Jack Lloyd <lloyd at randombit.net> wrote:
>
> On Tue, Jun 12, 2007 at 12:26:12AM +0500, topmop wrote:
> > Hello Friends
> >
> > I have compiled Botan 1.6.2 in VC++ environment without any problem. And
> now
> > i am trying to use it in Borland C++ Builder.
> >
> > When i try to compile a test program in C++ Builder, It gives me below
> error
> > in bigint.h
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------
>
> > Build
> >  [C++ Error] bigint.h(61): E2015 Ambiguity between
> 'MemoryRegion<unsigned
> > int>::operator unsigned int *()' and 'MemoryRegion<unsigned
> int>::operator
> > const unsigned int *() const'
> >  [C++ Error] bigint.h(83): E2015 Ambiguity between
> 'MemoryRegion<unsigned
> > int>::operator unsigned int *()' and 'MemoryRegion<unsigned
> int>::operator
> > const unsigned int *() const'
> >  [C++ Error] bigint.h(84): E2015 Ambiguity between
> 'MemoryRegion<unsigned
> > int>::operator unsigned int *()' and 'MemoryRegion<unsigned
> int>::operator
> > const unsigned int *() const'
> >
> ----------------------------------------------------------------------------------------------------------------------
> >
> > These 3 errors are on below 3 lines in bigint.h
> > --------return ((n < size()) ? reg[n] : 0);
> > -------- word& operator[](u32bit index) { return reg[index]; }
> > -------- word operator[](u32bit index) const { return reg[index]; }
> >
> > Just for testing, If i take out the reg variable from these lines and
> use a
> > constant value then i dont get any other error.
> >
> > Variable reg is of below type.
> > SecureVector<word> reg;
>
> It's been a very long time since I even tried using Botan under
> C++Builder (which version are you using, BTW?). I think the last was
> C++Builder 3 which used the same compiler as Borland C++ 5.0, which
> was incredibly buggy. This problem you're seeing is somewhat
> surprising, it seems like a lot of code would break if it is unable to
> distinguish between const and non-const calls in a scenario like this.


I am using Borland C++ Builder 6.0


First thought here is to take each of those functions and place them
> instead into big_base.cpp and recompile using Visual Studio. In
> general you should be able to hide most of the problems (in BigInt and
> elsewhere where a memory type is used in an inline function in a
> header) that way. On the other hand, I'm not certain with this bug
> still existing if it would be possible to really use the library very
> easily. Also this would induce a bit more runtime overhead due to the
> extra calls, but I don't think anything dramatically bad.
>
> I just took a look at Crypto++, which uses a similar memory block
> type, and it disables the const versions of the functions when
> __BORLANDC__ is defined. You may want to try that, commenting out
> or ifdef'ing out the lines
>       operator const T* () const { return buf; }
>       const T* begin() const { return buf; }
>       const T* end() const { return (buf + size()); }
> in secmem.h.
>
> Since simply commenting out those functions is fast, maybe it's worth
> a try to see how Borland reacts to that.


Ok thanks i will try these suggestions and will post back

> If you will ask for the code i am using, Then as such i am not using
> > anything, Just included below files and tried to compile to make sure
> they
> > will work, But apparently i need to change something to make it
> compatible
> > with Borland C++ Compiler?
>
> Seems likely. Hopefully it is relatively straighforward to get it at
> least compiling the headers. I'm a bit in the dark here but I'll help
> out as much as I can.


Before trying to use any further code i am just trying to make sure that
headers will work with c++ Builder. What actually i want to do after this is
i want to try to use ne7ssh-1.2.2 (SSH Client library) which depends on
Botan. ne7ssh-1.  ne7ssh have a commercial version for windows but they say
their linux code can be modified and compiled for free on windows so i was
thinking if i can go through the Botan issue without much code changes then
i can focus on net7ssh code modification.

> Just to make it clear, I am not compiling Botan itself in Borland C++
> > Builder, I am trying to use Botan in C++ Builder.
>
> That's probably a little safer in this case. Ideally Botan could be
> compiled entirely under Borland but I'm not sure how likely that is
> without major hackery.



I read in the list that  Botan will not compile in  Borlan C++ Builder
without  changes in code, Thats why i did not try to compile it in C++
Builder. I compiled it in VC++ (Actually VC++ 2005 Express edition Command
prompt). And just trying to use the headers and .lib with borland.

Do you think i should switch to Visual C++ For this project ?

-Jack
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://www.randombit.net/mailman/listinfo/botan-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20070612/ca91b771/attachment.html>


More information about the botan-devel mailing list