这是主函数代码,另外,demo.dll,demo.h,demo.link都复制到了该工程目录下
#include<stdio.h>#include"demo.h"
#pragma comment(lib,"demo")int main()
{
Func();
return 0;
}//dll原代码
#include "stdafx.h"
#include "demo.h"
#include<iostream>
int a;
using namespace std;BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
 )
{
    switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:

break;
    }
    return TRUE;
}//导出函数
void Func(void)
{
a = 5;
}//demo.h
#ifdef DEMO_EXPORTS
#define DEMO_API __declspec(dllexport)
#else
#define DEMO_API __declspec(dllimport)
#endifDEMO_API void Func(void);//连接出错信息
Linking...
a.obj : error LNK2001: unresolved external symbol __imp__Func
Debug/aa.exe : fatal error LNK1120: 1 unresolved externals
不知道是什么回事