VC6和VC7应用程序和DLL共存 [英] VC6 and VC7 applications and DLLs coexistence

查看:74
本文介绍了VC6和VC7应用程序和DLL共存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,


我面临以下情况,需要帮助找出可能出现的问题。


有一个DEFVCNET.exe表示,在VC6.0中开发了MFC应用程序,例如ABCVC6.exe和另一个在VC.NET中开发的
。这些应用程序有一些DLL将被使用

。所有这些DLL最初都是在VC6.0中开发的,但是其中一些现在已经迁移到VC.NET了。所以,我们假设我们有PQRVC6.dll

和XYZVCNET.dll。


ABCVC6.exe和DEFVCNET.exe可以同时工作并使用这些DLL

呢?

关于系统DLL的可能问题,比如mfc / ole dlls

等?


提前感谢您的想法/想法/意见。


问候,

Devender ......

解决方案

据我所知,一切都会好的。至于VC6.exe和

VCNET.exe同时使用相同的DLL - 我所知道的是,这些DLL是

意味着基于实例 - 那个'''为什么你可以使用LoadLibrary();. DLL的每个

实例都有自己的内存空间等。如果您的应用程序从中导入函数,则在运行时创建实例
。如果您需要

实例之间的通信使用如下数据段:


//包含文件


# pragma data_seg(sharedsectionxyz)

//变量在这里。

CLinkedList< CInstanceInfo_Base> g_llInstances;

#pragma data_seg()

#pragma comment(链接器,&/; SECTION:sharedsectionxyz,RWS")

/ * it我已经有一段时间了,因为我已经做了这个,我认为可能出错的唯一的东西是链接器的东西,但它看起来还不错

on a第二眼* /

// DllMain等


希望有帮助,如果您还需要更多信息,只需发送电子邮件至kawahee at gmail DOT

com。


- Todd


" Devender Khari"写道:

嗨朋友们,

我正面临如下情况,需要帮助找出可能出现的问题。

有一个在VC6.0中开发的MFC应用程序,例如ABCVC6.exe和另一个在VC.NET中开发的应用程序,比如DEFVCNET.exe。这些应用程序有一些DLL将被使用
。所有这些DLL最初都是在VC6.0中开发的,但是其中一些现在已经迁移到了VC.NET。所以,我们假设我们有PQRVC6.dll
和XYZVCNET.dll。

ABCVC6.exe和DEFVCNET.exe可以同时工作并使用DLL吗?
关于系统DLL如mfc / ole dlls
等可能存在哪些问题?

提前感谢您的想法/想法/意见。
问候,
Devender ......



感谢Todd的回复非常迅速。


我有一个内置在.Net中的MFC DLL,并希望在VC 6内置的exe中使用它。

这给了我一些问题。

有什么想法吗?


谢谢&此致,

Devender ......

Todd Aspeotis < Todd As******@discussions.microsoft.com >在消息中写道

新闻:0B ********************************** @ microsof t.com ...

据我所知,它应该都没问题。至于VC6.exe和
VCNET.exe同时使用相同的DLL - 我所知道的是DLL
是基于实例的 - 这就是为什么你可以使用LoadLibrary() ;。 DLL的每个实例都有自己的内存空间等。如果应用程序从中导入函数,则在运行时创建
实例。如果你需要在实例之间进行通信,请使用如下数据段:

//包含文件

#pragma data_seg(sharedsectionxyz)
//变量到这里。
CLinkedList< CInstanceInfo_Base> g_llInstances;
#pragma data_seg()
#pragma comment(链接器,&/; SECTION:sharedsectionxyz,RWS")
/ *它已经有一段时间了,因为我已经完成了这个,我认为唯一可能出错的是链接器的东西,但它看起来还好......第二眼就看了* /
// DllMain等
希望有帮助,如果你需要更多,只需发送电子邮件kawahee AT gmail
DOT com。

- Todd

Devender Khari写道:

嗨朋友们,

我正面临如下情况,需要帮助确定可能的
问题。
有一个在VC6.0中开发的MFC应用程序,例如ABCVC6.exe和
另一个在VC.NET中开发,DEFVCNET.exe说。这些应用程序可以使用几个到
的DLL。所有这些DLL最初都是在VC6.0
中开发的,但其中一些现在已迁移到VC.NET。所以,假设我们有
PQRVC6.dll和XYZVCNET.dll。

ABCVC6.exe和DEFVCNET.exe可以同时工作并使用DLL吗?
有关mfc / ole
dlls等系统DLL可能出现的问题?

提前感谢您的想法/想法/意见。
问候,
Devender ......



Hallo Devender!

我正面临如下情况,需要帮助找出可能存在的问题。

在VC6.0中开发了一个MFC应用程序,比如ABCVC6.exe和另一个开发的
在VC.NET中,说DEFVCNET.exe。这些应用程序有一些DLL将被使用
。所有这些DLL最初都是在VC6.0中开发的,但是其中一些现在已经迁移到了VC.NET。所以,我们假设我们有PQRVC6.dll
和XYZVCNET.dll。

ABCVC6.exe和DEFVCNET.exe可以同时工作并使用DLL吗?
关于系统DLL如mfc / ole dlls
等可能存在什么问题?




通常它们可以是cooexists,但它取决于你使用的方式和

编译了DLL的。

MFC-Extension DLL'必须编译并绑定到同一个共享MFC

DLL就像你的应用程序一样。

如果你只是建立常规的DLL'或使用静态链接的

版本的MFC,那也没问题。 />

如果使用不同版本的CRT来分配和释放内存,则会出现问题。即new / malloc在一个DLL中调用,并且

删除/自由形成另一个DLL,它们都链接到不同的CRT版本。


还要注意内存是你所需要的程序可能会比你想象的更多地提高
,因为CRT和MFC DLL的装载比一次更多




用DEPENDS.EXE检查情况

-

Martin Richter [MVP] WWJD

在C中我们不得不编码我们自己的错误。在C ++中我们可以继承它们。

FAQ: http:// www .mpdvc.de

样品: http:// www。 codeguru.com http://www.codeproject.com


Hi Friends,

I''m facing a situation as follows, need help on identifying possible issues.

There is an MFC application developed in VC6.0, say ABCVC6.exe and another
developed in VC.NET, say DEFVCNET.exe. There are a few DLLs that are to be
used
by these applications. All these DLLs are originally developed in VC6.0 but
some of them are now migrated to VC.NET. So, let''s say we have PQRVC6.dll
and XYZVCNET.dll.

Can ABCVC6.exe and DEFVCNET.exe can work simultaneously and use the DLLs
too?
What could be the possible issues regarding system DLLs like mfc/ole dlls
etc?

Thanks in advance for your ideas/thoughts/comments.

Regards,
Devender...

解决方案

To the best of my knowledge, it should all be fine. As for VC6.exe and
VCNET.exe using the same DLL(s) simultaneously - all I know is that DLLs are
meant to be instance based - that''s why you can use LoadLibrary();. Every
instance of a DLL has its own memory space etc. Plus an instance is created
at run time if your application imports functions from it. If you need to
communicate between instances use data segments like so:

// include files

#pragma data_seg(sharedsectionxyz)
// variables go here.
CLinkedList<CInstanceInfo_Base> g_llInstances;
#pragma data_seg()
#pragma comment(linker, "/SECTION:sharedsectionxyz,RWS")
/* it''s been a while since I''ve done this, I think the only thing
that might go wrong is the linker thing, but it looks alright
on a second glance */
// DllMain etc.

Hope that helps, if you need anything more, just email kawahee AT gmail DOT
com.

-- Todd

"Devender Khari" wrote:

Hi Friends,

I''m facing a situation as follows, need help on identifying possible issues.

There is an MFC application developed in VC6.0, say ABCVC6.exe and another
developed in VC.NET, say DEFVCNET.exe. There are a few DLLs that are to be
used
by these applications. All these DLLs are originally developed in VC6.0 but
some of them are now migrated to VC.NET. So, let''s say we have PQRVC6.dll
and XYZVCNET.dll.

Can ABCVC6.exe and DEFVCNET.exe can work simultaneously and use the DLLs
too?
What could be the possible issues regarding system DLLs like mfc/ole dlls
etc?

Thanks in advance for your ideas/thoughts/comments.

Regards,
Devender...



Thanks Todd for a very prompt reply.

I have an MFC DLL built in .Net and want to use it in an exe built in VC 6.
That''s giving me some problems.
Any ideas on that?

Thanks & Regards,
Devender...
"Todd Aspeotis" <Todd As******@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...

To the best of my knowledge, it should all be fine. As for VC6.exe and
VCNET.exe using the same DLL(s) simultaneously - all I know is that DLLs are meant to be instance based - that''s why you can use LoadLibrary();. Every
instance of a DLL has its own memory space etc. Plus an instance is created at run time if your application imports functions from it. If you need to
communicate between instances use data segments like so:

// include files

#pragma data_seg(sharedsectionxyz)
// variables go here.
CLinkedList<CInstanceInfo_Base> g_llInstances;
#pragma data_seg()
#pragma comment(linker, "/SECTION:sharedsectionxyz,RWS")
/* it''s been a while since I''ve done this, I think the only thing
that might go wrong is the linker thing, but it looks alright
on a second glance */
// DllMain etc.

Hope that helps, if you need anything more, just email kawahee AT gmail DOT com.

-- Todd

"Devender Khari" wrote:

Hi Friends,

I''m facing a situation as follows, need help on identifying possible issues.
There is an MFC application developed in VC6.0, say ABCVC6.exe and another developed in VC.NET, say DEFVCNET.exe. There are a few DLLs that are to be used
by these applications. All these DLLs are originally developed in VC6.0 but some of them are now migrated to VC.NET. So, let''s say we have PQRVC6.dll and XYZVCNET.dll.

Can ABCVC6.exe and DEFVCNET.exe can work simultaneously and use the DLLs
too?
What could be the possible issues regarding system DLLs like mfc/ole dlls etc?

Thanks in advance for your ideas/thoughts/comments.

Regards,
Devender...



Hallo Devender!

I''m facing a situation as follows, need help on identifying possible issues.

There is an MFC application developed in VC6.0, say ABCVC6.exe and another
developed in VC.NET, say DEFVCNET.exe. There are a few DLLs that are to be
used
by these applications. All these DLLs are originally developed in VC6.0 but
some of them are now migrated to VC.NET. So, let''s say we have PQRVC6.dll
and XYZVCNET.dll.

Can ABCVC6.exe and DEFVCNET.exe can work simultaneously and use the DLLs
too?
What could be the possible issues regarding system DLLs like mfc/ole dlls
etc?



Usually they can cooexists, but it depends on the way you use and
compiled the DLL''s.
MFC-Extension DLL''s must be compiled and bound to the same shared MFC
DLL like your application.
If you rae just building regular DLL''s or using the staticly linked
version of the MFC it is also no problem.

Problems will occure if you use different versions of the CRT to
allocate and free the memory. I.e. new/malloc called in one DLL, and
delete/free form another DLL both linked to different CRT versions.

Also be aware that the memory that is needed for you program might raise
more than you might thought, because CRT and MFC DLL''s are loaded more
than once.

Check the situation with DEPENDS.EXE
--
Martin Richter [MVP] WWJD
"In C we had to code our own bugs. In C++ we can inherit them."
FAQ : http://www.mpdvc.de
Samples: http://www.codeguru.com http://www.codeproject.com


这篇关于VC6和VC7应用程序和DLL共存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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