Reputation: 137
I am lost in a debugging session, because I am not able to locate the root of an access violation exception on application startup.
Is there any documentation on the VCL startup process/runtime?
The stacktrace looks like this:
Vcl::Forms::TApplication
\
initialization
\
__init_exit_proc
\
__wstartup
What happens when the application gets started? It all happens before WinMain
gets called, and before InitControls
get called in Vcl.Controls
. This strange behavior didn't happen in an earlier RAD Studio version. What is calling the function in Vcl::Forms
?
I have already read that the linker should have similar problems for a long time, and that disabling "Incremental Linking" should help, but unfortunately it didn't.
I don't understand technically the effects of the project on the exception, if the application hasn't even started yet. Might something have gotten overwritten in the linking stage, because of the large project size?
Is there anything I could try? How can I debug where everything starts?
If I catch the exception, the application startup process continues, and InitControls
gets called. But in the older RAD Studio version, the order was different, first InitControls
and only afterwards Vcl::Forms::TApplication
, so that Self
was not null.
EDIT:
The talk about the static initialization fiasco
made me remember the beginning of the problem and that the order is already guaranteed by the statement pragma package(smart_init)
(#pragma package):
The exception did only begin to occur after I had commented the pragma statement in the main unit, because of the original error I was getting in Vcl.Graphics
, like:
EInvaliGraphicOperation - Class instance of
CLSID_WICImagingFactory get created (800401F0)
Error occured in:
Vcl.Graphics
\
constructor Vcl::Graphics::TWICImage.Create
\
Vcl::ImageCollection::TImageCollectionSourceItem::Create -> Self:????
\
Vcl::ImageCollection::TImageCollection::Add
\
InitButtonsImageCollection()
\
Vcl::DbCtrls::TDBNavigator::Create::()
\
__init_exec_proc
\
__wstartup
And, as already mentioned, this only started to happen in Sydney. This is somewhere deep down the riverside in the VCL, I guess.
Upvotes: 1
Views: 148