[Botan-devel] App crashes trying to load certificate (VC7, Windows XP)

Ritwick Dhar ritwick.dhar at gmail.com
Mon Jun 6 12:07:22 EDT 2005


Hello,

I'm a new Botan user - just trying to get a sample app to load a X509
cert. Botan built fine using the config file and nmake, creating
libbotan.lib. However, while trying to build my app, I get the
following linker error:

--------------------------
libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::_Lockit(int)" (??0_Lockit at std@@QAE at H@Z) already defined
in libbotan.lib(pipe_io.obj)
libcpmt.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit at std@@QAE at XZ) already defined
in libbotan.lib(pipe_io.obj)

--------------------------
If I exclude the library libcpmtd.lib using the
/NODEFAULTLIB:"libcpmtd.lib" option, I get a bunch of errors saying:
---------------------
LIBC.lib(crt0dat.obj) : error LNK2005: ___crtExitProcess already
defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in
LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in
LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in
LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in
LIBCMT.lib(crt0dat.obj)
....
-------------------

If I exclude both offending libraries with /NODEFAULTLIB:"libcpmt.lib"
 and /NODEFAULTLIB:"libcmt.lib", the application builds, but crashes
at runtime with an exception:
---------------------
Object reference not set to an instance of an object.
   at Botan.MemoryRegion<unsigned char>.__dtor(MemoryRegion<unsigned char>* )
   at Botan.X509.load_key(basic_string<char,std::char_traits<char>,std::allocator<char>
>* )
   at main()
--------------------
The offending line is:
		X509_PublicKey* key = X509::load_key("d:\\documents\\workarea\\pubCert.pem");


Any help is greatly appreciated.

Regards
Rit



More information about the botan-devel mailing list