如何初始化堆,以便常规MFC dll中的静态构造函数可以使用它? [英] How to initialize the heap so it can be used by static constructors in a regular MFC dll?

查看:67
本文介绍了如何初始化堆,以便常规MFC dll中的静态构造函数可以使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


背景:我有一个带有MFC UI的大型遗留C ++应用程序。我正在尝试重构项目并将其迁移到新的.Net用户界面。现在作为第一步,我试图将Visual Studio 2015中的MFC exe项目重构为一个常规的
MFC dll,我可以从exe项目中调用它。 (见下文)我们计划逐步将UI从MFC移动到.Net。我们正试图在飞机飞行时改变发动机...

Background: I have a large legacy C++ application with an MFC UI. I am trying to refactor the project and migrate it to a new .Net UI. Right now as an initial step I am trying to refactor the MFC exe project in Visual Studio 2015, into an regular MFC dll which I can invoke from an exe project. (see below) Gradually we plan move the UI from MFC to .Net. We are trying to change the engine while the plane is in the air...

推荐答案

我得到"得到记忆"在没有MFC和没有C ++ / CLR的C ++控制台程序中。所以问题出在其他地方。

I get "got mem" in a C++ console program without MFC and without C++/CLR. So the problem is elsewhere.

您需要提供更多示例代码。至少告诉我们你有什么。你在DLL中有任何C ++ / CLR(.Net)吗?

You need to provide more sample code. At least tell us more about what you have. Do you have any C++/CLR (.Net) in the DLL?

请注意,你可以在
DllMain入口点
。分配内存是可以的,但是如果还没有加载其他DLL,那么任何需要从DLL加载另一个DLL的内容都将无效。有关详细信息,请参阅文档。

Note that there are limitations of what you can do in a DllMain entry point. Allocating memory is okay but anything that requires loading another DLL from/by your DLL won't work if the other DLL has not yet been loaded. See the documentation for more.


这篇关于如何初始化堆,以便常规MFC dll中的静态构造函数可以使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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