[botan-devel] RE : Using botan under VC ++ 6

Jack Lloyd lloyd at randombit.net
Tue Jun 28 08:29:17 EDT 2011

Hi Olivier,

Looking at the answers to this question:


It appears that the C++ runtimes between different releases are
incompatible, and in particular if the library allocates memory and
the application deallocates it, or the reverse, various interesting
forms of heap corruption will arise. This is pretty unfortunate given

   Pipe pipe(new FilterObject); // with Pipe deleting it later

is fairly idiomatic in the library API.

So unfortunately it seems that, no, you can't do this safely with
Visual C++. I think if you really need Visual C++ 6 support your
options are

 - Attempt to compile the library and make the necessary modifications
   to work around the bugs (but I think this would be a lot of work)

 - Write some code which completely wraps the specific operations you
   are wanting to do and which does not pass STL objects or memory
   across the call boundaries, compile it with VC 2010 and call it
   (and not botan directly) from your VC6-compiled code. Eg expose
     extern "C" void init_library();
     extern "C" void shutdown_library();
     extern "C" void encrypt_msg(unsigned char* buf, size_t len, ...);
     // etc
   and only call those.

   For this to work it appears you'll also have to statically link in
   the C++ runtime in both your application and in the VC2010 DLL
   (this is not the default option, and unfortunately there is no
   toggle for it, so you'll have to directly edit the makefile to
   switch from /MD to, I believe, /MT (for details see

 - Use a different library. According to
   Crypto++ does still support VC6, so you may want to consider using
   it instead.


On Mon, Jun 27, 2011 at 10:11:36PM +0200, olivier wrote:
> Hi Jack
> Thank you for your help. I'm sorry for my poor English, what I would say
> is I failed in linking my VC6 project to the botan library. I already
> succeed in building the library with VC 2010. Is it possible to link my
> project to the botan library with VC6.
> Regards 
> Olivier
> -----Message d'origine-----
> De : botan-devel-bounces at randombit.net
> [mailto:botan-devel-bounces at randombit.net] De la part de Jack Lloyd
> Envoyé : lundi 27 juin 2011 14:50
> À : botan-devel at randombit.net
> Objet : Re: [botan-devel] Using botan under VC ++ 6
> On Mon, Jun 27, 2011 at 11:23:31AM +0200, oli.l at neuf.fr wrote:
> > Hi,
> > 
> > I've succeed in compiling the botan library under VC 2010 environment.
> > But I'm developping under VC++ 6, is it possible to use the botan
> library under VC ++ 6 ?
> No, Visual C++ 6 does not support C++98 well enough to compile
> botan, or at least this was the case the last time anyone
> attempted it. VC 2003 and 2005 worked fine, though it also has
> not been tested anytime recently (at least to my knowledge). 2008
> and 2010 both work well.
> You might be able to compile the library using a more recent
> compiler and call it from a VC6 compiled application.
> -Jack
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel

More information about the botan-devel mailing list