在Symbian DLL中调用虚拟函数时出现问题 [英] Problem in calling a virtual function across Symbian DLLs

查看:197
本文介绍了在Symbian DLL中调用虚拟函数时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IM应用程序设置如下所示:




  • 用户界面模块(exe)

  • 插件模块(一个多态DLL,为UI模块提供不同协议的抽象接口)

  • 几个协议DLL(实现各自协议的共享库DLL,如Jabber,ICQ等) / li>


现在,我被要求实现联系人列表缓存功能,这意味着做文件I / O。



由于文件I / O不能在协议DLL中完成(它不能访问应用程序私有文件夹)
我实现了一个从用户界面模块中的抽象类接口派生的类。 p>

然后,我将抽象接口暴露给插件模块和协议DLL。



让抽象接口被命名为MFileService。



从协议DLL这是我如何获得一个MFileService派生类的实例:


  1. 协议DLL调用插件对象上的虚函数以获取指向MFileService派生对象的指针


  2. 插件对象调用用户界面模块上的虚拟函数。

    / li>
  3. 用户界面模块创建一个MFileService dervied类的实例并将其返回给调用者(插件对象)



问题是我的应用程序是用KERN崩溃的-EXEC 3在第1步,当它的虚拟函数调用
插件对象。



提示:




  • 从协议DLL对插件对象进行的所有虚拟函数调用都成功,但最近添加了


  • 我新添加到插件和用户界面模块中的虚拟函数返回指向MFileService的指针。


  • 我还没有导出任何虚拟函数都是纯虚拟的。



解决方案


由于文件I / O无法在协议DLL中完成(无法访问应用程序私有文件夹)


其实不是这样。 DLL代码在进程(exe)上下文中运行,并且基本上可以执行主要的任何操作,包括访问其专用目录数据库。


My IM application setup is like below:

  • User Interface module (exe)
  • Plugin module ( A polymorphic DLL that provides an abstract interface for different protocols to the UI module )
  • Several Protocol DLLs ( Shared library DLLs that implement the respective protocols, like Jabber, ICQ etc )

Now, I was asked to implement contact list caching feature and that meant doing File I/O.

Since File I/O cannot be done in the protocol DLLs ( it cannot access the applications private folder ) I implemented a class deriving from an abstract class interface in the user interface module.

I then exposed the abstract interface to the Plugin module and protocol DLLs.

Let that abstract interface be named MFileService.

From the protocol DLL this is how I get an instance of MFileService derived class:

  1. Protocol DLL calls a virtual function on plugin object to get a pointer to MFileService derived object

  2. Plugin object calls a virtual function on the user interface module.

  3. The user interface module creates an instance of MFileService dervied class and returns it to the caller ( The plugin object )

  4. The plugin object inturn returns it to the protocol DLL.

The problem is my application is crashing with KERN-EXEC 3 at step 1 when its making a virtual function call to plugin object.

HINTS:

  • All the virtual function calls made to the plugin object from the protocol DLL succeeds except the one I recently added.

  • The virtual function I newly added to the plugin and user interface modules return a pointer to MFileService.

  • I have not exported any of the virtual functions since all are pure virtual.

解决方案

Since File I/O cannot be done in the protocol DLLs ( it cannot access the applications private folder )

This is in fact not so. DLL code runs in the process (exe) context and can essentially do whatever the main exe can, including accessing its private directory data cage.

这篇关于在Symbian DLL中调用虚拟函数时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆