https://blog.youkuaiyun.com/dbyoung/article/details/94576926 这篇文章中,
调用 VC 的 C++ Class 类导出的 DLL 函数时,需要在 VC 中,对对象进行实例化。
不在 VC 中实例化,在 Delphi 实例化可不可行?答案是肯定的。
譬如 C++ Class Dll:
// 这是已导出类的构造函数。
CppDll::CppDll()
{
return;
}
int CppDll::MyAdd(int a, int b)
{
return a + b;
}
void CppDll::ShowMSG()
{
::MessageBoxA(0, (LPCSTR)"Delphi 调用 VC 类的成员函数", (LPCSTR)"系统提示:", MB_OK);
}
用 depends 查看导出函数
x86:
public: __thiscall CppDll::CppDll(void)
public: class CppDll & __thiscall CppDll::operator=(class CppDll &&)
public: class CppDll & __thiscall CppDll::operator=(class CppDll const &)
public: int __thiscall CppDll::MyAdd(int,int)
public: void __thiscall CppDll::ShowMSG(void)
x64:
public: __cdecl CppDll::CppDll(void) __ptr64
publ

本文详细介绍了如何在Delphi中调用VC++编译的DLL类函数,通过实例化C++类并导出成员函数,展示了在Delphi中声明对应的函数,并成功调用这些函数的过程,实现跨语言的函数调用。
最低0.47元/天 解锁文章
3万+

被折叠的 条评论
为什么被折叠?



