声明的Hello World DLL文件.运行时未找到外部函数
Declared Hello World DLL File. External Function Not Found at run-time
最初发布在这里(https://stackoverflow.com/questions/32617735/declared-dll-but-errors-external-function-not-found),但被告知不使用类或命名空间。转发一个简单的例子,我仍然不能去工作。
用c++ (Visual Studio)制作的DLL:// myFirstDLL.h
#define DECLDIR __declspec(dllexport)
DECLDIR int GIMMEFIVE();
// myFirstDLL.cpp
#include "stdafx.h"
#include "myFirstDLL.h"
#include <stdexcept>
//using namespace std;
int GIMMEFIVE()
{
return 5;
}
LotusScript代理:
Option Public
Option Declare
Declare Public Function GIMMEFIVE Lib "P:InternetdplowsvisualstudiomyFirstDLLmyFirstDLLDebugmyFirstDLL.dll" () As Integer
Sub Initialize
MsgBox GIMMEFIVE()
End Sub
要求将函数封装在extern "C"
块中;
extern "C"
{
extern __declspec(dllexport) int GIMMEFIVE();
}
同时声明为extern "C"
和__declspec(dllexport)
。如果您自己不从DLL中调用该函数,则不需要转发声明它。
extern "C" __declspec(dllexport) int GIMMEFIVE()
{
return 5;
}
相关文章:
- 调用外部函数,无法指定类型 C++/MVS
- 加载由 MATLAB Coder 生成的带有函数的 DLL,该函数调用外部函数
- add_cuda_library输出:未解析的外部函数
- 外部函数在 main() 上调用时返回分段错误 11.(C++)
- 如何在Windows Media Foundation中获取相机外部函数?
- 内联asm编译器屏障(内存阻塞器)是算作外部函数,还是算作静态函数调用
- antlr cpp target 的标头部分不允许使用具有默认参数的外部函数
- 将多维数组传递给外部"C"函数为 void *
- llvm 调用一个以 char * 作为参数的外部函数
- 将 std::vector<bool> 传递给外部函数
- 如何在类向量中存储/使用外部函数指针
- LLVM - 如何使嵌套函数看到外部函数的变量
- CUDA9.2及以上版本中模板默认参数存在无法解决的外部函数错误
- 宏导入外部函数
- 如何在LLVM Pass中将字符串传递给外部函数
- C++:是否可以区分外部"C"函数和普通函数?
- 从外部函数访问外部结构属性
- 如何将成员声明为指向外部"C"函数的指针?
- C 将外部函数链接为成员函数
- LLVM JIT编译的程序找不到外部函数