用模块文件创建DLL,如何进行隐式调用?
我用声明导出函数的办法,做出的DLL能够进行显式调用和隐式调用,但用模块文件导出的DLL,只能进行显式调用,目前还没掌握隐式调用的方法,特来请教各位高手。
//DllTest.h
#ifdef DLL_EXPORT
#define DLL_API extern "C" _declspec(dllexport)
#else
#define DLL_API extern "C" _declspec(dllimport)
#endif
DLL_API int add(int a,int b);
//DllTest.cpp
#define DLL_EXPORT
#include "DllTest.h"
int add(int a,int b)
{
return a+b;
}
//隐式调用代码
#include <stdio.h>
#include <conio.h>
#include "DllTest.h"
#pragma comment(lib, "DllTest.lib")
int main()
{
int a = 8, b = 3;
printf("%d+%d=%d\n", a, b, add(a, b));
getch();
return 0;
}
请问用模块文件创建的DLL没有头文件,我们如何进行隐式调用?
LIBRARY DllTest
EXPORTS
add
//DllTest.cpp
int add(int a, int b)
{
return a+b;
}