Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //StuffDLL.h
- #ifdef STUFFDLL_EXPORTS
- #define STUFFDLL_API __declspec(dllexport)
- #else
- #define STUFFDLL_API __declspec(dllimport)
- #endif
- namespace Stuff {
- class StuffMath {
- public:
- template<class T> static STUFFDLL_API T Ad(T a, T b);
- static STUFFDLL_API double Add(double a, double b);
- };
- }
- // StuffDLL.cpp : Defines the exported functions for the DLL application.
- //Turn off "precompiled headers"
- #include "StuffDLL.h"
- #include <stdexcept>
- using namespace std;
- namespace Stuff {
- double StuffMath::Add(double a, double b) {
- return (a + b);
- }
- template<class T>
- T StuffMath::Ad(T a, T b) {
- return(a + b);
- }
- }
- // DLLExec.cpp : Defines the entry point for the console application.
- #include <iostream>
- #include <Windows.h>
- #include "StuffDLL.h"
- using namespace std;
- int main() {
- cout << "a + b = " << Stuff::StuffMath::Ad(2, 3) << endl;
- system("pause");
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment