为什么我会收到"Unable to find an entry point named 'SquareRoot' in DLL"消息?
Why am I getting a "Unable to find an entry point named 'SquareRoot' in DLL" message?
我在VB.net项目中从dll调用c++函数有麻烦。我尝试过下面的简单示例
c++ dll
#include <cmath>
extern "C" __declspec(dllexport) double SquareRoot(double value)
{
return pow(value, 0.5);
}
我构建dll并将其复制到VB.net文件夹
For VB.net project
Module Module1
<Runtime.InteropServices.DllImport("DLL_Test.dll")> _
Private Function SquareRoot(ByVal value As Double) As Double
End Function
Sub Main()
MsgBox(SquareRoot(2))
End Sub
End Module
我一直得到Additional information: Unable to find an entry point named 'SquareRoot' in DLL 'DLL_Test.dll'
。当我在DLL_Test.dll
上运行dumpbin.exe
时,我得到以下
File Type: DLL
Summary
1000 .data
1000 .idata
2000 .rdata
1000 .reloc
1000 .rsrc
4000 .text
10000 .textbss
我不知道我错过了什么,任何想法?
Name mangling。extern "C"
不会关闭它,它只是改变了规则。
你也有一个调用约定不匹配。
您可以通过c++函数上的__stdcall
关键字一次解决这两个问题。
相关文章:
- boost::进程间消息队列引发错误
- 在线编译器中的分段C++没有打印消息
- C++错误消息*成员参考.**初学者*
- 在createdialog创建的窗口中捕获用于编辑控件的OnMouseMove消息
- 要与"if constexpr"一起使用的编译时消息(在预处理器之后)
- 如何通过参数抛出错误消息
- 从服务器传输到客户端的消息不会出现
- ROS2 动态消息模板
- C++秘密消息学校作业
- glad 导致 glfwSwapBuffers 返回错误消息
- C++入门 5 版:类消息和文件夹
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- 如何处理从一个对象传递到另一个在C++中具有公共抽象类的对象的消息
- 如何接受 [ENTER] 键作为无效输入并发送错误消息
- 由于无效的 ValidateRgn() 子窗口不会收到WM_PAINT消息
- "string.h"在构建适用于iOS的qt应用程序中找不到消息
- 如何将 Firebase 与基于 Linux 的客户端应用配合使用,以便与服务器进行双向消息通信
- 重新定义预定义的 errno 错误消息 (E2BIG)
- 为什么我会收到"Unable to find an entry point named 'SquareRoot' in DLL"消息?
- 为什么我总是收到错误消息"no member named "令牌类型 " in 'Token"?