DotNet andd C++ example

This commit is contained in:
kdeng00
2020-08-16 16:51:37 -04:00
commit bc545e7caf
7 changed files with 110 additions and 0 deletions
+13
View File
@@ -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)
+11
View File
@@ -0,0 +1,11 @@
#ifndef ARITHMETIC_H_
#define ARITHMETIC_H_
class Arithmetic {
public:
Arithmetic() = default;
int add(const int, const int);
};
#endif
+5
View File
@@ -0,0 +1,5 @@
#include "Arithmetic.h"
int Arithmetic::add(const int a, const int b) {
return a + b;
}
+13
View File
@@ -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);
}
}