Hi there,
I've seen at least one reference to an example usage for this Crypto++ override
(as follows):
extern "C" __declspec(dllexport) void __cdecl
GetNewAndDeleteForCryptoPP(PNew &pNew, PDelete &pDelete)
{
pNew = &operator new;
pDelete = &operator delete;
}
When I attempt to use this in my application (with Crypto++ v5.6.1 and Visual
Studio 2010 SP1) I receive an early CRT exception indicating the CRT is not
initialized. Indeed, when I step through the C initialization I see that
different run-times appear to be in use (in particular the CRT heap does not
appear to be initialized in the context of the allocation - even through the
heap in the context of the caller, i.e., the DLL init/cinit *has* initialized
the heap). I've confirmed that the cryptopp.dll being referenced is the stock
v5.6.1 build (using static CRT) and also that my application is built with the
static CRT as well (and with the cryptopp.dll import library).
Everything works fine if I, instead, remove the GetNewAndDeleteForCryptoPP()
and replace it with, for example (from dlltest.cpp):
static PNew s_pNew = NULL;
static PDelete s_pDelete = NULL;
extern "C" __declspec(dllexport) void __cdecl SetNewAndDeleteFromCryptoPP(PNew
pNew, PDelete pDelete, PSetNewHandler pSetNewHandler)
{
s_pNew = pNew;
s_pDelete = pDelete;
}
void * __cdecl operator new (size_t size)
{
return s_pNew(size);
}
void __cdecl operator delete (void * p)
{
s_pDelete(p);
}
Why is this?
Thanks,
-David
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.