1 选择new->project->win32 console project;
2 输入你的文件名字->按下next->选择DLL->选择OK;
3 在工程中添加一个与工程名字同名的test.h文件,在文件中写入代码: extern "C" __declspec(dllexport) void testexam(char *input); (文件名字是需要导出的文件名);
4 在cpp文件的头上其他include语句后面,添加#include "test.h",在其中写入你的函数void testexam(char *input); 编译即可。
2 输入你的文件名字->按下next->选择DLL->选择OK;
3 在工程中添加一个与工程名字同名的test.h文件,在文件中写入代码: extern "C" __declspec(dllexport) void testexam(char *input); (文件名字是需要导出的文件名);
4 在cpp文件的头上其他include语句后面,添加#include "test.h",在其中写入你的函数void testexam(char *input); 编译即可。
调用dll的方法:
配置:项目-->属性-->链接器-->输入中输入rxmdll.lib,
在程序中调用方法如下:
#include <iostream>
using namespace std;
#pragma comment(lib,"rxmdll.lib")
using namespace std;
#pragma comment(lib,"rxmdll.lib")
extern "C"_declspec(dllimport) void testexam(char* str);
using namespace std;
int main()
{
testexam("p.wmv");
{
}
详细过程参见:http://msdn.microsoft.com/zh-cn/library/ms235636(VS.80).aspx