c++ - 为什么 vba 不能成功调用用 c++ 编写的 dll?
问题描述
我得到了一个 c++ 演示,它成功调用了用 c++ 编写的 API,现在正在尝试从 excel VBA 调用这些 API。我做了很多研究,但仍然无法将它们联系在一起。
基本上在 demo 'TapQuote.h 中有一个这样的 API(TapQuoteAPI.dll) 导出函数
TAP_DLLEXPORT const TAPICHAR *TAP_CDECL GetTapQuoteAPIVersion();
在演示 c++ 解决方案(TapQuoteAPI_Demo)中,我在 demo.cpp 中包含“TapQuote.h”,
cout<<GetTapQuoteAPIVersion()<<endl
; _ 调用成功,结果打印。
但是当谈到在excel vba中调用这个函数时,我一直失败。
我尝试像这样在 excel 中直接使用 TapQuoteAPI.dll,但没有用。
Declare Function GetTapQuoteAPIVersion Lib "D:\Proejct\WIN32\TapQuoteAPI.dll" () As String
然后我还尝试使用来自 TapQuoteAPI_Demo.dll 的 deFile.def 构建另一个 dll 函数,因为我在 c++ 演示中成功调用了它。
Declare Function GetTapQuoteAPIVersion Lib "D:\Proejct\WIN32\TapQuoteAPI_demo.dll" () As String
也失败了。有人可以为我点亮一些灯吗?
解决方案
推荐阅读
- excel - 来自 VBA 的 DLL 声明行中的编译器错误“未定义用户定义的类型”
- installation - Hyperledger Fabric - 示例 - 2.2.0 平台特定结构二进制文件不可下载
- sql - 用 100 万条记录填充表
- spring-boot - 如何使用带有自定义标头的 OAuth1.0 使用 Spring Boot 对 API 进行身份验证
- java - Cassandra 节点拒绝加入集群“Compaction Executor”错误
- android - 如何使用 kotlin 从另一个类调用同伴内部的扩展对象?
- file-io - 使用特定的 strftime 格式时无法打开 Outfile 错误 (NSIS 3.0.5) !define /date "NOW"
- firebase - 在等待之后我应该返回一个承诺吗?
- python - 使用statsmodel时如何将常量放在第一位?
- javascript - JSON.stringify() 将整数转换为指数