30 lines
380 B
C++
30 lines
380 B
C++
|
#include "ex_lib.h"
|
||
|
#include "my_math.h"
|
||
|
#include <new>
|
||
|
|
||
|
struct math_struct {
|
||
|
my_math impl;
|
||
|
};
|
||
|
|
||
|
extern "C"
|
||
|
math_struct* create()
|
||
|
{
|
||
|
return new(std::nothrow) math_struct;
|
||
|
}
|
||
|
|
||
|
extern "C"
|
||
|
int get_sum(struct math_struct* ms, int a, int b)
|
||
|
{
|
||
|
if (!ms)
|
||
|
return -1;
|
||
|
return ms->impl.GetSum(a, b);
|
||
|
}
|
||
|
|
||
|
extern "C"
|
||
|
void free_math(struct math_struct* ms)
|
||
|
{
|
||
|
if (!ms)
|
||
|
return;
|
||
|
delete ms;
|
||
|
}
|