gpt4 book ai didi

c++ - DllMain 应该命名为另一个名称吗?

转载 作者:行者123 更新时间:2023-12-01 15:10:25 25 4
gpt4 key购买 nike

我正在学习 DLL,我在 MSDN 中看到了以下段落:

If you are providing your own entry-point, see the DllMain function. The name DllMain is a placeholder for a user-defined function. You must specify the actual name you use when you build your DLL. For more information, see the documentation included with your development tools.

当尝试为初学者创建一个小 dll 时,我注意到如果我用不同的名称调用我的 DllMain,
它没有被调用..

这一段是什么意思?这个函数真的不应该被称为 DllMain
但其他名字?操作系统如何知道调用什么函数?

最佳答案

他们的意思是,一段文本,即 DllMain 是 DLL 入口点函数的默认名称

默认名称 意味着,除非您以其他方式配置编译器,否则编译器将假定名为 DllMain 的函数应该是入口点。

这反过来意味着您可以配置您的编译器将任何其他名称视为入口点。通常,编译器将其视为某种 /commandlineparam-commandlineparam。请参阅文档。

编辑:哦,我刚刚注意到您正在使用 MSVC。
这是那部分: enter image description here

关于c++ - DllMain 应该命名为另一个名称吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62985140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com