WellRe: New wiki work - an Allegro game kit.

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
Icy_Viking said...

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

https://www.experts-exchange.com/questions/22006727/Wrapping-a-managed-C-DLL-in-a-unmanaged-C-project.html

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.

http://blogs.microsoft.co.il/sasha/2012/01/28/managed-unmanaged-interoperability-in-the-2010s-part-2-pinvoke-unmanaged-to-managed/

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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu