话不多说,先贴代码:
test.dll
test.h
#ifdef TEST_EXPORTS
#define TEST_API __declspec(dllexport)
#else
#define TEST_API __declspec(dllimport)
#endif
TEST_API int testadd(int a,int b);
test.cpp
#include "stdafx.h"
#include "test.h"
// 自己写的测试函数
TEST_API int testadd(int a,int b)
{
return a+b;
}
test.def
LIBRARY "test"
EXPORTS
testadd
loadtest.exe
loadtest.cpp
// loadtest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
printf("hello\n");
**typedef<