12345678910111213141516171819202122232425262728293031323334 |
- // win32dll.cpp : 定义 DLL 应用程序的导出函数。
- //
- #include "stdafx.h"
- //#include "win32dll.h"
- #ifdef WIN32DLL_EXPORTS
- #define MYDLL_API _declspec(dllexport) // 导出dll函数,供外部使用;
- #else
- #define MYDLL_API _declspec(dllimport) // 导出dll函数,供dll内部使用;
- #endif // NONMFCDLL_EXPORTS
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- MYDLL_API int g_result;
- MYDLL_API int add(int a, int b);
- MYDLL_API int add2(int a, int b);
- #ifdef __cplusplus
- };
- #endif
- // 函数实现可以在extern "C"外实现;
- int add(int a, int b)
- {
- return g_result = a+b;
- }
- int add2(int a, int b)
- {
- return g_result +a+b;
- }
|