Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Yuraj on August 17, 2009, 12:24:34 PM

Title: WME PlugIn and C# / .NET
Post by: Yuraj on August 17, 2009, 12:24:34 PM
Hi,
Today I tried to rewrite wme plugin sdk to c# (i trought that wme plugins are .net assemblies), but it is not possible to make plugin with some .net language?
Thanks in advance!
Title: Re: WME PlugIn and C# / .NET
Post by: Mnemonic on August 17, 2009, 01:05:29 PM
WME plugins are "normal" DLL libraries, not .NET assemblies. If you wanted to write plugin in C#, you'd have to create some kind of wrapper DLL (written in C++/CLI), which would export standard DLL functions, but internally route the calls to C# code.
Title: Re: WME PlugIn and C# / .NET
Post by: Mnemonic on August 17, 2009, 01:07:10 PM
The debugging console (wme_console.dll) works in a similar fashion. You can check the sources.
Title: Re: WME PlugIn and C# / .NET
Post by: Mnemonic on August 17, 2009, 09:18:33 PM
If anyone's interested, I've put together a really quick&dirty project which contains a simple plugin (derived from wme_sample), which instantiates a C# class and redirect a script method ("SampleMethod") to the C# class method, which displays a message box.

It's really just a proof of concept more than anything else. One would need to do a lot more stuff, for example it would be nice to have some neat .NET wrapper classes for the engine objects available to plugins.

http://dead-code.org/download/demos/wme_dotnet.zip

It requires Visual Studio 2005 or later because it uses C++/CLI.
Title: Re: WME PlugIn and C# / .NET
Post by: Yuraj on August 18, 2009, 01:10:05 PM
If anyone's interested, I've put together a really quick&dirty project which contains a simple plugin (derived from wme_sample), which instantiates a C# class and redirect a script method ("SampleMethod") to the C# class method, which displays a message box.

It's really just a proof of concept more than anything else. One would need to do a lot more stuff, for example it would be nice to have some neat .NET wrapper classes for the engine objects available to plugins.

http://dead-code.org/download/demos/wme_dotnet.zip

It requires Visual Studio 2005 or later because it uses C++/CLI.
Many thanks Mnemonic, I will look on it later.  :)
//sorry for my bad english, som zo Slovenska  ;)