1 选择new->project->win32 console project;
在这一步的选框上有一个选项是 create dictionary for solution, 我不知道这个具体是什么作用,选了之后会项目出现两层文件夹,比如你创建一个命名为test的项目,会生成test文件夹,test中包含另一个test文件夹,你的项目实际上放在了内层test文件夹中。选与不选对于后续的创建没有影响。这个的具体作用等我查明白了再补上!
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);
5 在build->batch build 中将两个选项都选中,然后选择这个选项框中的编译指令
OK, now you can get your dll and lib file in the release and debug file folder! Congratulations !