A native AoT .NET C# audio engine using FMOD Core, with an example C++ project invoking the exposed C# methods.
All of the C# code is entirely native AoT, with a few methods exposed in Shared Native project
intended to be called from unmanaged code.
- Download the repo
- Run
dotnet publish src\Shared -c Release --use-current-runtime --property:PublishDir=src\Examples\cpp\lib
to publish the Shared native AoT .dll, .lib, and .pdb files to the C++ example project'slib
directory - Open the
C++ example solution
in Visual Studio - Run the project to see C# code being invoked from C++
The CFlat.Core
project mainly houses models, extensions, and constants for the application.
The CFlat.Application
project contains all of the services and factories.
The CFlat.Native
project contains events, which are "exposed" methods that are intended to be invoked from unmanaged code.
The CFlat.Example
project is an example of invoking the exposed events from the Shared Native project.
The InteropService
manages loading the native AoT libraries and creating function pointers from the exposed events in CFlat.Application
.
The AudioEngineService
and SoundService
invoke the functions created by the InteropService
.
The main function
shows the final result, a simple and easy way to invoke methods defined in C# from C++!