plugin based applications in C# projects

I know c++ and c# well.But never develop a big project that have so many components and will be extended for long time.

1-)I need advices from developers.How must i design it If i design it fully native code(c++)Must i build it over com technology or something else And what must my project settings be

2-)Especially i think that i want to design my UI in c# and then other parts that my algorithms are working with c++.Because i don't want that my codes can decompile by reflector or salamander.
Maybe i must start with c# windows app. then other parts are native code with c++.But i am not sure that it is right way.You know UI designing with c# is very easy and funny, but with mfc and win32 it is very boring.But decompiling is very big disadvantage for me.I am confused.I said i am not sure.Here what will be the advanteges or disadvantages Is it really right way

3-)If i develop my UI with c# and my plugins are c++(Com objects).Do i lost performance so much Or it is not importatnt.Which subjects must i be careful.Are there any samle applications like that project.I really need...

4-)Also if i design my programs UI or shell with .net code(like c#) , in future i can utilize .net plugins but if my shell code or UI in c++ i can not write any plugin with managed code.Is this right

I want to learn all your opinions and advices about such a program.I don't want to make mistake.
I am looking for your answers..
Thanks
Good works...


Answer this question

plugin based applications in C# projects

  • Jason Barrett

    I see, sorry I didn't saw that part.

    I'm not actually sure if unmanaged C++ can implement an interface in managed code (C#), but you can try reading interoperatibility in this MSDN article:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dndotnet/html/manunmancode.asp

    But if managed interface cannot be implemented from unmanaged code, then probably your best option is API exposure from unmanaged code, and "assume" that the methods you need is always exported by the unmanaged DLL (which will be your plug-in). This is the same assumption that is implemented by regsvr32 utility to register COM server, it assumes that a has an entry point to DllRegisterServer function, otherwise regsvr32 will treat the DLL as "cannot be registered".

    It somehow works like an interfacing, except that it's based on your C# application's assuming that all the needed extension is exported by unmanaged C++ DLL, otherwise you C# application will treat the plug-in as invalid.

    Hope this helps a little,

    -chris

  • Troika

    Thanks chris these links are very useful, i looked them i understand that they are about c# exes and c# plugins.But i want to design my app. in c# but my plugins will be in native code(c++).

    So i can not use Assembly.load..It will be differnet than your links codes.If wrong please correct it.I am looking for such a sample application, or what will be problems if i design it like my said,advantages/disadvantages that i don't know or to what must i pay attention to...

    Thanks again...

  • Herman Post

    Hi,

    Check this Morrison Swartz Free .NET Plugin Library:
    http://www.ms-inc.net/dotnet.aspx ProductID=Plugins

    You can read from the source code on how to implement extensible C# application, or use the library for free.

    Also you can check this article:
    http://www.divil.co.uk/net/articles/plugins/plugins.asp

    It discusses how to write a plug-in based application in .NET (source in VB.NET)

    Regards,

    -chris

  • plugin based applications in C# projects