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

  • 相关阅读:
    java对对象或者map的属性进行排序
    java生成32的md5签名串
    mybatis检测mysql表是否存在
    eureka服务注册发现流程和核心参数
    概率分布之间的距离度量以及python实现(三)
    距离度量以及python实现(二)
    距离度量以及python实现(一)
    tensorflow 1.0 学习:用别人训练好的模型来进行图像分类
    tensorflow 1.0 学习:模型的保存与恢复(Saver)
    tensorflow 1.0 学习:参数和特征的提取
  • 原文地址:https://www.cnblogs.com/cb168/p/7764743.html
Copyright © 2011-2022 走看看