zoukankan      html  css  js  c++  java
  • dev16 cxgrid 在DLL里报0地址错

    dev16 cxgrid 在DLL里Form里使用,报0地址错,在EXE里正常。c++builder 的DLL报错,delphi也报错。

    First chance exception at $09CE9B44. Exception class $C0000005 with message 'access violation at 0x09ce9b44: read of address 0x00000000'.

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    self.cxGrid1DBTableView1.CreateColumn;
    end;

    最终指向了 cxGridCustomTableView.pas

    function TcxCustomGridTableView.CreateItem: TcxCustomGridTableItem;
    begin
      Result := GetItemClass.Create(Owner);
      AddItem(Result);//error
    end;

    function TcxCustomGridTableItem.CanFilter(AVisually: Boolean): Boolean;
    begin
      Result :=
        (esoFiltering in GetProperties.GetSupportedOperations) and FOptions.Filtering and
        (not AVisually or GridView.OptionsCustomize.ItemFiltering and FOptions.FilteringPopup);
    end;

    DevExpress VCLExpressCore LibrarySourcesdxCore.pas  
     //在这里看到dll的初始化和exe是分开的。exe直接调用,dll在InitializeList里。InitializeList是不是需要手动调用?
     procedure TdxUnitsLoader.AddUnit(const AInitializeProc, AFinalizeProc: Pointer);
    var
      AProc: TdxProc;
    begin
      if AInitializeProc <> nil then
      begin
        AProc := AInitializeProc;
        if not dxIsDLL then
        begin
          IsInitialized := True;
          AProc;
        end
        else
          InitializeList.Add(AInitializeProc);
      end;
      if AFinalizeProc <> nil then
        FinalizeList.Add(AFinalizeProc);
    end;

    最后发现dxCore.pas文件里有2个函数,就是专门初始化的,在DLL里init和退出时finalize。

    procedure dxInitialize; stdcall;
    procedure dxFinalize; stdcall;

    The dxInitialize & dxFinalize procedure must be used if you develop your project with DLLs.

    But if you compile your DLL with active runtime packages, you don't need to call dxInitialize & dxFinalize manually.

    原来的引用dxGDIPlusAPI修改为dxCore 
    原来的方法dxGdiPlusInitialize修改为dxInitialize 
    原来的方法dxGdiPlusFinalize修改为dxFinalize

    Note that the dxInitializeGDIPlus and dxFinalizeGDIPlus functions have been moved to the dxCore unit. They were renamed to dxInitialize and dxFinalize respectively.

    参考

    http://www.cnblogs.com/jupt/p/3922935.html

    官方

    https://www.devexpress.com/Support/Center/Question/Details/Q470319/dynamic-loaded-dll-with-packages-av-s-in-dxcore

    http://bbs.2ccc.com/topic.asp?topicid=414492

    https://www.board4all.biz/threads/richeditcontrol-generates-an-error-is-this-a-bug.666000/

    https://www.devexpress.com/Support/Center/Question/Details/Q387588/delphi-xe2-and-dxinitializegdiplus-problem

  • 相关阅读:
    Django动态渲染多层菜单
    python使用pdkdf2加盐密码
    ceil 模块
    python面试总结
    Django 中related_name,"%(app_label)s_%(class)s_related"
    安装zabbix-3.0.3+nginx-1.10.1+php-5.6.22
    Django 权限管理
    python RecursionError: maximum recursion depth exceeded in comparison错误
    django _meta方法
    html 之input标签height设置问题
  • 原文地址:https://www.cnblogs.com/cb168/p/7764743.html
Copyright © 2011-2022 走看看