Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef IMPORTDLL_EXPORTS
- #define IMPORTDLL_API __declspec(dllexport)
- #else
- #define IMPORTDLL_API __declspec(dllimport)
- #endif
- // This class is exported from the ImportDLL.dll
- class IMPORTDLL_API CImportDLL {
- public:
- CImportDLL(void);
- // TODO: add your methods here.
- int Add(int a , int b);
- };
- extern IMPORTDLL_API int nImportDLL;
- IMPORTDLL_API int fnImportDLL(void);
- IMPORTDLL_API int fnMultiply(int a,int b);
- #include "stdafx.h"
- #include "ImportDLL.h"
- // This is an example of an exported variable
- IMPORTDLL_API int nImportDLL=0;
- // This is an example of an exported function.
- IMPORTDLL_API int fnImportDLL(void)
- {
- return 42;
- }
- IMPORTDLL_API int fnMultiply(int a , int b)
- {
- return (a*b);
- }
- [DllImport("ImportDLL.dll")]
- public static extern int fnMultiply(int a, int b);
- extern "C" MYDLL_API int __stdcall fnMultiply(int a, int b)
- {
- return a*b;
- }
- // Note: update also the .h DLL public header file with __stdcall.
- LIBRARY MYDLL
- EXPORTS
- fnMultiply @1
- ...
- [DllImport("MyDLL.dll)]
- public static extern int fnMultiply(int a, int b);
- extern "C" IMPORTDLL_API int fnMultiply(int a , int b)
- {
- return (a*b);
- }
Add Comment
Please, Sign In to add comment