c++winapic++builderc++builder-2010

Variant or safe array is locked When Load DLL in C++ Builder 10


I've upgrade a C++ project 6 to C++ builder 10.

When I loading DLL with LoadLibrary, throwing that exception.

HINSTANCE hInst;
hInst = LoadLibrary( "MyLibrary.dll" );

Project XXXX.exe raised exception class EOutOfResources with message 'Variant or safe array is locked'.

I didn't undertand that "Variant or safe array is locked" expression.

I've tried load DLL in new empty application.DLL is loading.There is not any problem.

But can't load DLL in existing project.

How do I determine source of problem ?


Solution

  • Problem reason;

    I've compared two .cbproj files with notepad++

    I created DLL with C++ Builder 10

    <PropertyGroup>
        <ProjectGuid>{E3FB4C71-C382-46EC-A17D-5C25890309CD}</ProjectGuid>
        <ProjectVersion>18.0</ProjectVersion>
        <FrameworkType>VCL</FrameworkType>
        <Base>True</Base>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <TargetedPlatforms>1</TargetedPlatforms>
        <AppType>Library</AppType>
    </PropertyGroup>
    

    I upgraded DLL C++ Builder 6 to 10

    <PropertyGroup>
        <ProjectGuid>{923C6CCC-2F12-4C36-B9B1-C765AE96A7A2}</ProjectGuid>
        <ProjectType>CppDynamicLibrary</ProjectType>
        <Base>True</Base>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <FrameworkType>None</FrameworkType>
        <ProjectVersion>18.0</ProjectVersion>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <TargetedPlatforms>1</TargetedPlatforms>
        <AppType>Library</AppType>
    </PropertyGroup>
    

    The difference is FrameworkType.

    I've replaced None To VCL.

    DLL is loaded.