This project gives a worked example of how to start the .NET Core runtime from C++ on Linux/MacOs, create an initial application domain (AppDomain), and execute managed code in it.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Linux or MacOs (code tested on Red Hat Enterprise Linux Server release 7.3 (Maipo))
- .NET Core 2.0
- Python (tested using 2.7.11)
- GCC
Clone the repository
git clone <path_to_repo>
cd <repo_folder>/src
Modify the clrFilesPath variable in pynetinit.cpp as required, to point to your installed dotnet distribution.
Build the .NET .dll
dotnet build ./dotnet
Build the python extension (uses GCC)
python setup.py build_ext --inplace
Run python and call the test function
python
>>> import clr
>>> clr.sum(4,5)
9.0
- Ivan Cronyn - Initial work - Cronan on GitHub
- Thanks to Yi Zhan for his article on Embedding CoreCLR in your C/C++ application
- Thanks to the Python for .Net team