Thank you, Peter:
Is P/Invoke the most common way to call C++ from C#?
Does C++/CLI work on all WinForm control functionalities?
Regarding Networking,
Do you mean System.Net namespace?
Our Network library is based on Winsock/Linux BSD socket.
Did you imply that there are some other Network library can replace winsock
?
Steve
"Peter Duniho" <(E-Mail Removed)> 撰寫於郵件新聞

(E-Mail Removed)...
> On Wed, 22 Apr 2009 01:02:22 -0700, Steve <(E-Mail Removed)> wrote:
>
>> Hi Pavel:
>>
>> I need WinForm to make a good-looking UI (provided by artists).
>> I also have a C++ network library done by the other team. and 2 game
>> applications.
>> Combine all these. I should make a portal / lobby application for
>> match-making.
>>
>> Is C++/CLI is the only solution?
>
> No. You can use the C++ library from C# or other managed languages by
> using p/invoke. But it would be easiest from C++/CLI.
>
> On the other hand, I find C# and VB.NET much better suited to the managed
> code environment. C++/CLI allows you to access all the same features, but
> for the managed code aspects, I find the syntax awkward in pretty much
> every way that I find C# elegant. So if you'd rather have more convenient
> coding of the managed aspects, not counting dealing with p/invoke, then
> using p/invoke might be the way to go.
>
> After all, if you do everything in C++/CLI, then you're dealing with the
> syntax all the time. But if you do p/invoke, you only have to create the
> p/invoke stuff once.
>
> Yet another possibility is to wrap the network library in a managed
> C++/CLI library, and then use that from C#. This gives you more explicit
> control over how the unmanaged-to-managed conversion happens. But it's
> not necessarily less work than just using p/invoke.
>
> And of course there's always the option of simply porting the network
> library to .NET. The fact is, .NET has very good network i/o classes
> already; depending on what your network library is actually doing, a .NET
> version might be a lot simpler, or you may find you don't need the network
> library at all. (Yes, I know first-hand it's no fun to be working on a
> project that turns out to be deemed obsolete...but IMHO it's better to
> pick the right solution than to stick with something you don't really need
> just because you've already invested time and effort in it).
>
> Pete