博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
dev16 cxgrid 在DLL里报0地址错
阅读量:7251 次
发布时间:2019-06-29

本文共 2217 字,大约阅读时间需要 7 分钟。

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);beginself.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 VCL\ExpressCore Library\Sources\dxCore.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

你可能感兴趣的文章
查询数据库所有依赖
查看>>
git常用命令
查看>>
两个无符号数相减 可以得到负数
查看>>
Mysql数据库的基本概念
查看>>
浅谈axios
查看>>
[20190213]测试服务端打开那些端口.txt
查看>>
[Django学习] Django基础(3)_templates与static配置
查看>>
Linux知识补充点
查看>>
转发小程序
查看>>
c++入门笔记
查看>>
练习5.6.3节
查看>>
Drupal 中文社区分布图谱
查看>>
oracle pctfree和pctused详解
查看>>
Poj1861--Network(最小生成树)
查看>>
大型网站架构体系的演变 负载均衡架构设计
查看>>
axios 搭配laravel无法跨域问题解决
查看>>
[转] HTML5利用WebRTC的getUserMedia获取摄像头信息模拟拍照及视频(完整示例)
查看>>
CSS border三角、圆角图形生成技术简介
查看>>
python接口自动化:发送https请求
查看>>
聊聊 Python 的内置电池
查看>>