weidai11/cryptopp

destructor delete problem with own dialog program with MFC (Unicode/Use MFC in a Shared DLL) VS2015

dan2001o opened this issue · 0 comments

Hi,

I really need help with this done: I have simple program, which is working fine except for deleting part

I use VS2015 and my Settings or my program are:

General: (Unicode + Use MFC in a Shared DLL)
Link: Multi-threaded DLL (/MD)
link with static lib "cryptlib.lib"

code

#define CRYPTOPP_DEFAULT_NO_DLL
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1

#include <dll.h>
#include <cryptlib.h>
#include <sha.h>
#include <hex.h>
#include <filters.h>


void CMyDlg::TestCrypto()
{
  using namespace CryptoPP;

  SHA256 hash;
  std::string message = "abcdefghijklmnopqrstuvwxyz";
  std::string digest;
  {
    StringSink MySink(digest);
    HexEncoder MyHexEncoder(&MySink);
    HashFilter MyHash(hash, &MyHexEncoder);

    StringSource s(message, true, &MyHash);
    s.PumpAll();
  }
}

it building and linking fine, but after function is ran and deleting is being done this function it will crash

I have crypto 8.9 / I use WIN_32 Release with Static library (.lib) / Use MFC in a Shared DLL / Unicode / Multi-threaded DLL (/MD)

when I use another settings I get link errors etc. (the program must be same compiler options as the crypt.lib)

my problem looks a lot like this
https://stackoverflow.com/questions/59163281/runtime-library-heap-error-using-crypto-and-vs2019-with-mfc

but a solution of this was not found by me

Kind Regards
Dan