Re: Hello, has anyone succ on using cryptopp with latest c++ builder

One Sini <[email protected]> Tue, 9 Sep 2025 11:07:17 +0200
Newsgroups gmane.comp.encryption.cryptopp
Message-ID <CAJm61-BfZB2Ji53iH+DJqs-cR5hAyJDzUxrdw2Qc0iVwaf8tPQ@mail.gmail.com>
--00000000000031d5c6063e5aa26a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=E2=80=99ll of=
ten
get *access
   violations*.

*Runtime library mismatch*

   -

   Check that both Crypto++ and your application are built against the *sam=
e
   C++ runtime library* (e.g. =E2=80=9CMulti-threaded DLL=E2=80=9D vs =E2=
=80=9CMulti-threaded
   static=E2=80=9D).
   -

   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=E2=80=99s 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=E2=80=99t handle that correctly, you=E2=80=99ll see acces=
s 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 s=
ame
   runtime, allocator, and ABI =E2=86=92 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 t=
o
> static lib.
>
> However, during using, especially when calling anything invove SecByteBlo=
ck,
> 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=3Demail&utm_source=3Dfooter>
> .
>

--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/cryptopp-us=
ers/CAJm61-BfZB2Ji53iH%2BDJqs-cR5hAyJDzUxrdw2Qc0iVwaf8tPQ%40mail.gmail.com.

--00000000000031d5c6063e5aa26a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div><h3 style=3D"color:rgb(0,0,0);font-style:normal;letter-spacing:normal;=
text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;tex=
t-decoration:none">Typical causes (especially with C++ Builder + Crypto++)<=
/h3><p style=3D"color:rgb(0,0,0);font-style:normal;font-weight:400;letter-s=
pacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-s=
pacing:0px;text-decoration:none"><strong>ABI / Memory allocator incompatibi=
lity</strong></p><ul style=3D"color:rgb(0,0,0);font-style:normal;font-weigh=
t:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space=
:normal;word-spacing:0px;text-decoration:none"><li><p>Crypto++ is primarily=
 tested with Visual C++ and GCC, but less so with Embarcadero.</p></li><li>=
<p><code>SecByteBlock</code>=C2=A0internally uses=C2=A0<code>AlignedAllocat=
e</code>/<code>AlignedDeallocate</code>, which can behave differently depen=
ding on compiler conventions for memory alignment and=C2=A0<code>operator n=
ew/delete</code>.</p></li><li><p>If you link Crypto++ as a static lib that =
was built with a different runtime (RTL) or allocator settings than your pr=
oject, you=E2=80=99ll often get=C2=A0<strong>access violations</strong>.</p=
></li></ul><p style=3D"color:rgb(0,0,0);font-style:normal;font-weight:400;l=
etter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal=
;word-spacing:0px;text-decoration:none"><strong>Runtime library mismatch</s=
trong></p><ul style=3D"color:rgb(0,0,0);font-style:normal;font-weight:400;l=
etter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal=
;word-spacing:0px;text-decoration:none"><li><p>Check that both Crypto++ and=
 your application are built against the=C2=A0<strong>same C++ runtime libra=
ry</strong>=C2=A0(e.g. =E2=80=9CMulti-threaded DLL=E2=80=9D vs =E2=80=9CMul=
ti-threaded static=E2=80=9D).</p></li><li><p>If not: crashes are guaranteed=
.</p></li></ul><p style=3D"color:rgb(0,0,0);font-style:normal;font-weight:4=
00;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:no=
rmal;word-spacing:0px;text-decoration:none"><strong>Name mangling / excepti=
on handling differences</strong></p><ul style=3D"color:rgb(0,0,0);font-styl=
e:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transfo=
rm:none;white-space:normal;word-spacing:0px;text-decoration:none"><li><p>Em=
barcadero uses its own C++ ABI. If Crypto++ was compiled with an incompatib=
le ABI (for example clang or mingw, then linked into Builder), it will brea=
k.</p></li><li><p>You must ensure it=E2=80=99s built with the=C2=A0<strong>=
same compiler and the same flags</strong>.</p></li></ul><p style=3D"color:r=
gb(0,0,0);font-style:normal;font-weight:400;letter-spacing:normal;text-inde=
nt:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decorat=
ion:none"><strong>Memory alignment issues</strong></p><ul style=3D"color:rg=
b(0,0,0);font-style:normal;font-weight:400;letter-spacing:normal;text-inden=
t:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decorati=
on:none"><li><p><code>SecByteBlock</code>=C2=A0often requests 16-byte align=
ed memory (for SSE/AVX). If the compiler doesn=E2=80=99t handle that correc=
tly, you=E2=80=99ll see access violations.</p></li><li><p>Some Builder vers=
ions have known issues with alignment.</p></li></ul><hr style=3D"font-style=
:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transfor=
m:none;white-space:normal;word-spacing:0px;text-decoration:none"><h3 style=
=3D"color:rgb(0,0,0);font-style:normal;letter-spacing:normal;text-indent:0p=
x;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:n=
one">Possible solutions</h3><ul style=3D"color:rgb(0,0,0);font-style:normal=
;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;=
white-space:normal;word-spacing:0px;text-decoration:none"><li><p><strong>Em=
bed Crypto++ directly into your project</strong><br>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=
 =E2=86=92 many problems go away.</p></li><li><p><strong>Check RTTI and exc=
eptions</strong><br>C++ Builder sometimes uses different exception mechanis=
ms. Make sure RTTI and exceptions are consistently enabled.</p></li><li><p>=
<strong>Align build settings</strong></p><ul><li><p>Same runtime library (e=
.g. Multi-threaded Debug DLL or the static variant)</p></li><li><p>Same com=
piler options for memory/alignment</p></li></ul></li><li><p><strong>Alterna=
tive: build Crypto++ as a DLL</strong><br>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.</p></li></ul></div><div dir=3D"auto">Have nice =
day=C2=A0</div><div><br><div class=3D"gmail_quote gmail_quote_container"><d=
iv dir=3D"ltr" class=3D"gmail_attr">William Schwank &lt;<a href=3D"mailto:s=
[email protected]">[email protected]</a>&gt; schrieb am Di. 9. Sept. 2025 =
um 01:53:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 =
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, everyone, I&#39;m =
a c++ builder user, and tring to use cryptopp with c++ builder.<div><br></d=
iv><div>With the lastest version c++ builder, I succ compile and build cryp=
topp to static lib.</div><div><br></div><div>However, during using, especia=
lly when calling anything invove=C2=A0<span style=3D"background-color:rgba(=
0,0,0,0);white-space:pre-wrap;color:rgb(31,35,40);font-family:&quot;Monaspa=
ce Neon&quot;,ui-monospace,SFMono-Regular,&quot;SF Mono&quot;,Menlo,Consola=
s,&quot;Liberation Mono&quot;,monospace;font-size:11.9px">SecByteBlock, </s=
pan>the application will just got exited, with errors like=C2=A0<span style=
=3D"color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,&quot;=
Segoe UI&quot;,&quot;Noto Sans&quot;,Helvetica,Arial,sans-serif,&quot;Apple=
 Color Emoji&quot;,&quot;Segoe UI Emoji&quot;">=C2=A0</span><span style=3D"=
color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,&quot;Sego=
e UI&quot;,&quot;Noto Sans&quot;,Helvetica,Arial,sans-serif,&quot;Apple Col=
or Emoji&quot;,&quot;Segoe UI Emoji&quot;">Access violation at address 00E8=
7383 in module xxX.</span></div><div><span style=3D"color:rgb(31,35,40);fon=
t-family:-apple-system,BlinkMacSystemFont,&quot;Segoe UI&quot;,&quot;Noto S=
ans&quot;,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Se=
goe UI Emoji&quot;"><br></span></div><div><span style=3D"color:rgb(31,35,40=
);font-family:-apple-system,BlinkMacSystemFont,&quot;Segoe UI&quot;,&quot;N=
oto Sans&quot;,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&qu=
ot;Segoe UI Emoji&quot;">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.</span></di=
v>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Crypto++ Users&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]" targ=
et=3D"_blank">[email protected]</a>.<br>
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
cryptopp-users/dda6224f-5905-43b4-b93c-da3878027471n%40googlegroups.com?utm=
_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">https://groups.g=
oogle.com/d/msgid/cryptopp-users/dda6224f-5905-43b4-b93c-da3878027471n%40go=
oglegroups.com</a>.<br>
</blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Crypto++ Users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">cryp=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
cryptopp-users/CAJm61-BfZB2Ji53iH%2BDJqs-cR5hAyJDzUxrdw2Qc0iVwaf8tPQ%40mail=
.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.co=
m/d/msgid/cryptopp-users/CAJm61-BfZB2Ji53iH%2BDJqs-cR5hAyJDzUxrdw2Qc0iVwaf8=
tPQ%40mail.gmail.com</a>.<br />

--00000000000031d5c6063e5aa26a--