如何控制Dll加载的顺序? [英] How can I control the order of Dll were loaded ?

查看:95
本文介绍了如何控制Dll加载的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用vs2008,开发一个no-mfc常规win32-Dll(名为DisplayTT.Dll),它使用了QT库;

我还有一个console32程序来使用该DLL,它们都使用windows标准库和使用多字节字符集。



编译和链接都没问题。但是当我在vs2008中使用F5运行它时,它会改变可以找不到程序条目.....在QtCored4.DLL中。



很奇怪,我找不到解决问题的方法!



更多,vs vs IDE的输出窗口中的Alt + 2,QtCored4.DLL已加载。但就在我的win32 DLl。(名为DisplayTT.Dll)之后



我用Google搜索了,但是找不到办法!



帮助!拜托!



BTW,我如何把jpg图片放在这里?

I use vs2008,develop a no-mfc regular win32- Dll(named DisplayTT.Dll) , which used QT library ;
I also have a console32 program to use that DLL, they all use windows standard library and Use Multi-Byte Character Set.

compile and link are both OK.But when I Run it with F5 in vs2008, It will alter "Can''t locate the program entry will ..... in QtCored4.DLL".

Is strange and I can''t find a way to solve the problem!

what''s more,Alt+2 in the output window of vs IDE, The QtCored4.DLL has been loaded. but just after my win32 DLl.(named DisplayTT.Dll)

I have googled ,but haven''t find a way!

Help! please!

BTW,How Can I put the jpg picture here?

推荐答案

正确的方法就是相反:基于对DLL加载顺序的任何假设的任何技术都应被视为不正确且永远不会被使用。它会滥用和破坏软件开发过程,以及最终结果的质量和可靠性。



很可能,你真的只关心它的顺序执行DLL入口点。在这种情况下,有效的解决方法是这样:删除对执行顺序敏感的代码(这是一个非常有问题的属性本身)到一些显式导出的DLL函数,并在文档中解释调用这些函数的正确顺序。它们都可以是名称 Initialize 或类似名称。这仍然是丑陋的,但是合法的。



-SA
Right approach is just the opposite: any technique based on any assumptions on the order of loading of DLLs should be considered as incorrect and never be used. It would abuse and sabotage the process of software development, as well as the quality and reliability of final results.

Chances are, that you really care only about the order of execution of the DLL entry points. In this case, the valid work-around is this: remove the code sensitive to the order of execution (which is a very questionable property itself) to some explicitly exported DLL function and explain in the documentation the correct order of calling such functions. They all could be names Initialize or something like that. This would be still ugly, but legitimate.

—SA


你试过吗? a href =http://msdn.microsoft.com/en-IN/library/yx9zd12s(v=vs.80).aspx> / DELAYLOAD [ ^ ] Visual Studio中的链接器选项?



你可以把你的DisplayTT放在这个列表中。



检查这里 [ ^ ]了解延迟加载的更多信息。



I希望这有帮助
Did you try the /DELAYLOAD[^] linker option in Visual studio?

you can put your DisplayTT in this list.

Check here[^] for more info on delayed loading.

I hope this helps


这篇关于如何控制Dll加载的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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