// Dll1.cpp : 定义 DLL 的导出函数。
//
#include "pch.h"
#include "framework.h"
#include "Dll1.h"
#pragma comment(linker,"/EXPORT:Add=Dll2.Add")
// Dll2.cpp : 定义 DLL 的导出函数。
//
#include "pch.h"
#include "framework.h"
#include "Dll2.h"
int Add(int a, int b)
{
return (a + b);
}
#include<iostream>
#include<Windows.h>
using namespace std;
typedef int(*FUNC)(int a, int b);
int main()
{
HMODULE hModule = LoadLibraryA("Dll1.dll");
FUNC mAdd = (FUNC)GetProcAddress(hModule, "Add");
int result = mAdd(1, 2);
cout << result << endl;
cin.get();
return 0;
}