Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //DLLArith - These are all the Source Files for DLLArith
- //Add.cpp
- #include "Add.h"
- // Defining a member function outside of class
- int Add::Calc(int v1, int v2)
- {
- return v1+v2;
- }
- -----------------------------------------------------------------------------
- //DLLArith.cpp
- #include <iostream>
- using namespace std;
- // IMPORTANT: DLLTEST_API will perform an export of the exposed functions
- #define DLL_EXPORT
- // Include the header, must come after #define DLL_EXPORT
- #include "DLLArith.h"
- #include "Add.h"
- #include "Subtract.h"
- extern "C"
- {
- DLLTEST_API IArith* NewObject(int operation)
- {
- if(operation == 0){
- return new Add();
- }
- else if(operation == 1){
- return new Subtract();
- }
- else{
- return NULL;
- }
- }
- DLLTEST_API void DelObject(IArith *pObject)
- {
- delete pObject;
- }
- }
- ------------------------------------------------------------------------
- // Subtract.cpp
- #include "Subtract.h"
- // Defining a member function outside of class
- int Subtract::Calc(int v1, int v2)
- {
- return v1-v2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement