I have a programm which supports plug-ins and there is a 'manual' how to write it on C++.
I'd like to write my plug-in using C#.
Here is some valuable extracts from THAT manual.
1. Base application was written with C++ and using MFC. So they begins creating plug-ins by choosing 'Regular DLL using shared MFC DLL' in MSVC.
2. Next main step is to write two functions in
sample.h:
class SampleClass : public CWinApp
{
public:
SampleClass();
void OnLoad();
void OnInitialize(CMapStringToString&);
}
sample.cpp:
SampleClass theApp;
__declspec(dllexport) void OnLoad() {theApp.OnLoad();}
__declspec(dllexport) void OnInitialize(CMapStringToString& str) {theApp.OnInitialize(str);}
sample.def
OnLoad= OnLoad@@YAXXZ
OnInitialize= OnInitialize@@YAXAAVCMapStringToString@@@Z
3. Plugin forms must be in MDI style and the main program would call functions OnLoad() and OnInitialize(something)
Is it possible to write all of the above using C# and please tell me how to do it
Maybe show me any directions in which I could move. Maybe read something...
Thanks a lot.
Andy.

Cross-language.
Will Merydith
stswordman
Read this:
http://www.codeproject.com/managedcpp/unmanaged_to_managed.asp
GSReddy
koldFUSiON
I don't think so. It should take much more time to jump from c# to c++. I already tried and realised that i can't. C# is much more easy language than C++. And it hard TO ME write anything simple with C++.
All I need is a 'cover' for this functions in c#!
And I don't believe that it is impossible.
msaradhi
Tom De Cort
I've been almost unerstood.
Please micvos, correct me if I am not right.
I must to write a C++ DLL, as shown in my manyal for base application. This project should contain a managed wrapper of unmanaged code which is called from base application (i.e. OnLoad and OnInitialize). Also in this metods I'd place a call of the similar external MANAGED metods (something like redirection).
And with c# I write everything managed and put in in another DLL.
So the base application calls OnLoad which is in c++ dll, and it calls (from inside) another OnLoad2 from my c# dll.
Would it work at all (if I write all these dll as I describe before).
J_Craig
Cravensadie
I don't see this as practical. (that is, I won't see it's "impossible", but it'll be really, really difficult)
The problem is that OnInitialize expects a CMapStringToString object (from MFC). The class is conceptually similar to the StringDictionary class in .Net, but they aren't binary-compatible, which means you'll need module to manually handle the marshalling between the two. The module would have to be able to understand both a StringDictionary and a CMapStringToString and copy every item from one to the other. This might be possible in Managed C++ code with unsafe section --- but, this module would also need to derive from MFC's WinApp class, which I don't think is possible in Managed C++.