c++builderc++builder-10.1-berlin

EOutOfResources in DLL


I migrated several DLLs and an application from Embarcadero C++ Builder XE to C++ Builder 10.1 Berlin.

Now when my DLL (which contains forms) gets loaded by the application, I get

EOutofResources "Das angegebene übergeordnete Element ist kein übergeordnetes Element von '%s'"

in TApplication::CreateHandle

After searching for hours, I found no one with the same error, not even the english translation. I would translate it as "The specified parent element is not a parent element of '%s'".

My stacktrace:

Stack trace

When I set breakpoints in my DLL's code, none are triggered, so I am not sure why there is even a call to the TApplication constructor (there IS one in my code, but it doesn't seem to be called).

I suspect some issue with dependencies, so I used dependency walker and it found two 64-bit dlls. Not sure if this is a false positive:

dependency walker output

What can I do to fix or diagnose this further?


Solution

  • I tried starting a new VCL type project to see if there were differences in the project setup, and lo and behold:

    <PropertyGroup>
        <ProjectGuid>{E8815773-6421-4FB8-A109-F4F505A67A2E}</ProjectGuid>
        <ProjectVersion>18.2</ProjectVersion>
        <FrameworkType>VCL</FrameworkType>
        <AppType>Application</AppType>
        <MainSource>Project1.cpp</MainSource>
        <Base>True</Base>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <TargetedPlatforms>1</TargetedPlatforms>
    </PropertyGroup>
    

    The newly created project has an element FrameworkType set to VCL. My migrated project had this set to None. After changing this to VCL, the error went away.