Typical causes (especially with C++ Builder + Crypto++)
*ABI / Memory allocator incompatibility*
-
Crypto++ is primarily tested with Visual C++ and GCC, but less so with
Embarcadero.
-
SecByteBlock internally uses AlignedAllocate/AlignedDeallocate, which
can behave differently depending on compiler conventions for memory
alignment and operator new/delete.
-
If you link Crypto++ as a static lib that was built with a different
runtime (RTL) or allocator settings than your project, you’ll often
get *access
violations*.
*Runtime library mismatch*
-
Check that both Crypto++ and your application are built against the *same
C++ runtime library* (e.g. “Multi-threaded DLL” vs “Multi-threaded
static”).
-
If not: crashes are guaranteed.
*Name mangling / exception handling differences*
-
Embarcadero uses its own C++ ABI. If Crypto++ was compiled with an
incompatible ABI (for example clang or mingw, then linked into Builder), it
will break.
-
You must ensure it’s built with the *same compiler and the same flags*.
*Memory alignment issues*
-
SecByteBlock often requests 16-byte aligned memory (for SSE/AVX). If the
compiler doesn’t handle that correctly, you’ll see access violations.
-
Some Builder versions have known issues with alignment.
------------------------------
Possible solutions
-
*Embed Crypto++ directly into your project*
Instead of linking as a static library, add the Crypto++ source files
(*.cpp) directly into your C++ Builder project. That way it shares the same
runtime, allocator, and ABI → many problems go away.
-
*Check RTTI and exceptions*
C++ Builder sometimes uses different exception mechanisms. Make sure
RTTI and exceptions are consistently enabled.
-
*Align build settings*
-
Same runtime library (e.g. Multi-threaded Debug DLL or the static
variant)
-
Same compiler options for memory/alignment
-
*Alternative: build Crypto++ as a DLL*
If static linking keeps failing, build Crypto++ as a DLL, export only
the API you need, and use it that way. This reduces ABI coupling.
Have nice day
William Schwank <[email protected]> schrieb am Di. 9. Sept. 2025 um 01:53:
> Hello, everyone, I'm a c++ builder user, and tring to use cryptopp with
> c++ builder.
>
> With the lastest version c++ builder, I succ compile and build cryptopp to
> static lib.
>
> However, during using, especially when calling anything invove SecByteBlock,
> the application will just got exited, with errors like Access violation
> at address 00E87383 in module xxX.
>
> Does any has a clue and succ use this lib with c++ builder? I know this
> tool has only a very small group of users.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/cryptopp-users/dda6224f-5905-43b4-b93c-da3878027471n%40googlegroups.com
> <https://groups.google.com/d/msgid/cryptopp-users/dda6224f-5905-43b4-b93c-da3878027471n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/cryptopp-users/CAJm61-BfZB2Ji53iH%2BDJqs-cR5hAyJDzUxrdw2Qc0iVwaf8tPQ%40mail.gmail.com.