#include
#pragma hdrstop
#include "FmrMain.h"
#pragma package(smart_init)
#pragma resource "*.fmx"
TForm1 *Form1;
const String Hello = "Hello";
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ShowMessage(Hello);
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
ShowMessage(Hello);
}
< /code>
Ich kompile dies mit dem Clang Enhanced C ++ 11 Compiler BCC32C, führen Sie die Anwendung aus und schließen Sie das Formular erneut. Wenn tform1 :: FormDestroy Hello genannt wird, wird bereits zerstört. Wenn ich den Code für Win32 mit dem klassischen Compiler BCC32 kompiliere, wird die Zeichenfolge nach Formdestroy zerstört. Warum verhält sich der Clang -basierte Compiler hier anders?class Foo {
public:
Foo(){};
~Foo(){}
};
Foo A;
//--------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--------------------------------------------------------------------------
__fastcall TForm1::~TForm1()
{
}
< /code>
Die Schöpfungs- und Zerstörungs -Wege ist so. Ich habe die Anrufstapel hinzugefügt. />
: 00405070 __cxx_global_var_init3 ()
: 004052a3 _global__i_a ()
: 00405AB7; ~ Foo
: 321fa2b7; C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\CC32C240MT.DLL
:321fa6ff CC32C240MT.__wstartup + 0xbb
- create Form1 < /li>
< /ol>
: 004052ec tform1 (this =: 00402422, __ctor_flag = '\ 0')
: 0085c1399 fmx240.@fmx@forms@tapplication@createForm $ qqrxp17System@tmetaClassspv + 0x5d
: 0085c349 fmx240.@fmx@forms@tapplication@realcreatreforms $ qqrv + 0x81 < /P. start = "4">
Zerstöre foo < /li>
< /ol>
: 004052d0 ~ foo (this =: 0040B7DC)
: 0040509e __dtor_a ()
: 321f624624624662466246624662466246624662466246624662466246624624624624624624624624624624624624624624624624624624624624624624. CC32C240MT.___call_atexit_procs + 0x52
:321f671c CC32C240MT.___exit + 0x20
destroy Form1
bcc32 (Classic borland compiler)
- create Foo
: 004048a0 stcon0 < /em> ()
: 00405727; Iot
: 322190f1; C: \ Programmdateien (x86) \ Embarcadero \ Studio \ 18.0 \ bin \ cc32240mt.dll>: 322193b5 CC32240MT .__ Wstartup + 0xa5 < /p>
bra Blockquote>
:00404994 TForm1::TForm1(this=:02F2AE20, Owner=:02F39620)
:0095c139 fmx240.@Fmx@Forms@TApplication@CreateForm$qqrxp17System@TMetaClasspv +
0x5d
: 0095C349 fmx240.@fmx@forms@tapplication@realcreateForms $ qqrv + 0x81 < /p>
< /blockquote>
:00404ABC TForm1::~TForm1(this=:02F2AE20)
[*]destroy Foo
[/list]
:00404978 Foo :: ~ foo (this =: 00409b74)
: 0040493f stdes0 < /em> ()
: 0040573f; iRoot>
: 3221910f; C: \ Programmdateien (x86) \ Embarcadero \ Studio \ 18.0 \ bin \ cc32240mt.dll
: 3221915b; C: \ Programme (x86) \ Embarcadero \ Studio \ 18.0 \ bin \ cc32240mt.dll>: 3221944a; C: \ Programmdateien (x86) \ Embarcadero \ Studio \ 18.0 \ bin \ cc32240mt.dll