#ifndef DLL_H
#define DLL_H
// MathFuncsDll.h
namespace math {
class MyMathFuncs
{
public:
// Returns a + b
staticdouble CALL Add(double a, double b);
// Returns a - b
staticdouble CALL Subtract(double a, double b);
// Returns a * b
staticdouble CALL Multiply(double a, double b);
// Returns a / b
// Throws DivideByZeroException if b is 0
staticdouble CALL Divide(double a, double b);
};
}
#endif
#include "Dll.h"
#include <stdexcept>
#include <iostream>
usingnamespace std;
namespace math {
double MyMathFuncs::Add(double a, double b)
{
return a + b;
}
double MyMathFuncs::Subtract(double a, double b)
{
return a - b;
}
double MyMathFuncs::Multiply(double a, double b)
{
return a * b;
}
double MyMathFuncs::Divide(double a, double b)
{
if (b == 0)
{
thrownew invalid_argument("b cannot be zero!");
}
return a / b;
}
}
you'll have to use some tool to find out mangle names, I don't know how do do that on linux.
when you find out mangle name the you assign your funciton names to that mangled names like you see in my example.
EDIT:
after you do that then just compile the project with all the files including definition file.
at the end you got a dll which exports those funcitons in human readable names.
you'll have to link that dll to your IDE to be able using funcitons...
you'll have to load the library into your project... also I have no idea on how to do that on linux.