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'.

  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3. self.cxGrid1DBTableView1.CreateColumn;
  4. 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

dev16 cxgrid 在DLL里报0地址错的更多相关文章

  1. sql server中调用c#写的dll里的方法

    最近有一项目: 一超市管理系统单机版,运行在WIN2003+SQL2005上,每天超市关门都都会关电脑,现客户要新加功能,每天关门下班后回家可以上网查看超市管理系统的数据库里的相关数据,然后再做一些原 ...

  2. 远程线程注入DLL突破session 0 隔离

    远程线程注入DLL突破session 0 隔离 0x00 前言 补充上篇的远程线程注入,突破系统SESSION 0 隔离,向系统服务进程中注入DLL. 0x01 介绍 通过CreateRemoteTh ...

  3. 在dll里malloc/new/cvCreate分配内存,在exe里free/Releases释放内存时会出错。

    写了个程序,在DLL中用malloc分配了一块内存,但是在exe程序中释放,结果程序crash,原因就是:其原因可能是堆被损坏,这也说明 TestMySticker.exe 中或它所加载的任何 DLL ...

  4. kendo method:destroy 解决有些在kendo.all.js 的js 库里报错问题

    首先,不得不承认,kendo UI 是个不错的东西,特别对于一个前端开发到行不足的程序猿来说.而在我们使用过程中貌似还是会遇到各种奇怪的问题.比如我们会经常用到对一些控件进行重赋值. destroy ...

  5. NX二次开发-C#使用DllImport调用libufun.dll里的UF函数(反编译.net.dll)调用loop等UF函数

    在写这篇文章的时候,我正在头晕,因为下班坐车回家,有些晕车了.头疼的要死.也吃不下去饭. 版本:NX11+VS2013 最近这一年已经由C++过度到C#,改用C#做应用程序开发和NX二次开发. C#在 ...

  6. Ceph部署mon出现0.0.0.0地址

    前言 最近在群里两次看到出现mon地址不对的问题,都是显示0.0.0.0:0地址,如下所示: [root@lab8106 ceph]# ceph -s cluster 3137d009-e41e-41 ...

  7. 问题-[Delphi]用LoadLibrary加载DLL时返回0的错误

    问题现象:用LoadLibrary加载DLL一直返回0句柄,无法进行下一步操作,但同样的代码可以访问到别的DLL.问题处理:1.你加载的路径是不对的,一定要看好路径.2.你是在虚拟机中操作的DLL,因 ...

  8. 借助微软提供的url重写类库URLRewriter.dll(1.0)实现程序自动二级域名,域名需要泛解析

    二级域名和系统中会员帐号自动关联,也就是系统中注册一个会员,会员自动就可以通过二级域名来访问,比如我的帐号是zhangsan,我在morecoder.com注册后,访问zhangsan.morecod ...

  9. unity3d MonoDevelop引用外部自定义dll文件报错:are you missing an assembly reference?

    在unity3d 编辑器 MonoDevelop 中引用外部自定义dll文件报错:are you missing an assembly reference? 因为unity还停留在.NET Fram ...

随机推荐

  1. java为什么匿名内部类的参数引用时final(转)

    https://blog.csdn.net/z69183787/article/details/68490440 https://www.zhihu.com/question/21395848 htt ...

  2. 在docker宿主机上查找指定容器内运行的所有进程的PID

    转载 https://www.cnblogs.com/keithtt/p/7591097.html 找到指定容器的所有进程的PID可以更方便的对容器进程进行管理,特别是在某些容器卡住无法连接的场景. ...

  3. Zabbix 创建触发器

    #1   配置 主机名10.0.0.33 触发器 点击创建触发器 #2 #4 点击添加 #触发器添加完毕

  4. Socket传输简单的信息以及粘包问题的解决

    一.简单的socket程序——传输简短文字: # -*- coding: utf-8 -*- # -*- Author: WangHW -*- import socket whw_client = s ...

  5. sqlserver创建数据库

    --指向当前要使用的master数据库,向master数据库中注册创建信息 use master go --创建数据库 create database StudentManageDB on prima ...

  6. DevExpress GridView删除行

    int[] rows = gridView1.GetSelectedRows(); ) { if (DialogHelper.YesNo(this, "确认删除该记录?", &qu ...

  7. 基于 MBTiles 规范扩展的缓存文件格式说明

    MBTiles 是由 MapBox 制定的一种将瓦片地图数据存储到SQLite数据库中并可快速使用,管理和分享的规范.该规范由MapBox制定,详见http://mapbox.com/mbtiles- ...

  8. Linux常用指令之二

    1.用户权限     1).查看文件属性 ls -l file(ll别名)         drwxr-x--- 2 root root 4096 Jan 20 19:39 mnt         # ...

  9. 有关Set集合的一个小问题

    先看两段代码: Demo1: Set<Short>s=new HashSet<>(); for(Short i=0;i<100;i++){ s.add(i); s.rem ...

  10. centos7安装gitlab并汉化

    一.基础环境准备 1.安装依赖包 [root@gitlab-server ~]#yum install curl policycoreutils openssh-server openssh-clie ...