DotNet andd C++ example
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required (VERSION 3.10)
|
||||
|
||||
project (TestExample CXX)
|
||||
|
||||
set (SOURCES
|
||||
src/Arithmetic.cpp
|
||||
src/Entry.cpp)
|
||||
|
||||
set (HEADERS
|
||||
include/Arithmetic.h)
|
||||
|
||||
add_library(TestExample SHARED ${SOURCES} ${HEADERS})
|
||||
include_directories(include)
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef ARITHMETIC_H_
|
||||
#define ARITHMETIC_H_
|
||||
|
||||
class Arithmetic {
|
||||
public:
|
||||
Arithmetic() = default;
|
||||
|
||||
int add(const int, const int);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "Arithmetic.h"
|
||||
|
||||
int Arithmetic::add(const int a, const int b) {
|
||||
return a + b;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "Arithmetic.h"
|
||||
|
||||
|
||||
extern "C" {
|
||||
int add(int, int);
|
||||
|
||||
|
||||
int add(int a, int b) {
|
||||
Arithmetic matics;
|
||||
|
||||
return matics.add(a, b);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user