最初发布在此处(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:\Internet\dplows\visualstudio\myFirstDLL\myFirstDLL\Debug\myFirstDLL.dll" () As Integer
Sub Initialize
MsgBox GIMMEFIVE()
End Sub
答案 0 :(得分:3)
该函数需要包含在extern "C"
块;
extern "C"
{
extern __declspec(dllexport) int GIMMEFIVE();
}
答案 1 :(得分:0)
将其声明为Mat img;
vector<mat> images;
for (i = 1; i < 5, i++)
{
img.create(h,w,type); // h,w and type are given correctly
// input an image from somewhere to img correctly.
images.push_back(img);
img.release();
}
for (i = 1; i < 5; i++) images[i].release();
和extern "C"
。如果您没有自己从DLL调用该函数,则无需转发声明它。你可以全部内联:
__declspec(dllexport)