WellRe: New wiki work - an Allegro game kit.
- Posted by Icy_Viking Jan 07, 2018
- 1590 views
Of course if XNA/MonoGame is ever ported to C and the needed DLLs are made, I might just wrap it. Though I don't see it happening as XNA/Monogame is written in C# using the .NET Framework.
It can certainly be done:
https://stackoverflow.com/questions/5947835/wrapping-c-sharp-code-to-be-called-from-c
Here's an example using COM:
https://www.codeproject.com/Articles/9903/Calling-Managed-Code-from-Unmanaged-Code-and-vice
Another example, but without COM:
https://www.codeproject.com/articles/378826/how-to-wrap-a-csharp-library-for-use-in-java
One could also create a wrapper C dll that had an init function that takes a lot of function pointers, and then a helper C# dll that wraps XNA/MonoGame in delegates and then calls the C init function via p/invoke to pass the function pointers inside the delegates. Then the C wrapper would call a function pointer which would pass to XNA/MonoGame.
Well those are some useful examples. I might take a crack at it, though Monogame is fairly big, so it would take a good chunk of time to wrap it. Still this is good to know.