Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2007

Tip: Looking for answers? Try searching our database.

C++/CLI wrapper generator

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zolof - 02 Aug 2007 11:12 GMT
I have a lost of C# classes from many DLLs to use from my legacy C++ EXE
application.
Is there a generator that would use reflexion (for example) to generate a
C++/CLI wrapper.
Jochen Kalmbach [MVP] - 02 Aug 2007 18:27 GMT
Hi zolof!
> I have a lost of C# classes from many DLLs to use from my legacy C++ EXE
> application.
> Is there a generator that would use reflexion (for example) to generate a
> C++/CLI wrapper.

I dont't understand your question...

If you want to use C# DLLs (assemblies) than you do not need to generade
C++/CLI wrappers... just use the assemblies...

Or maybe I missed the point...

Just compiler your EXE with /clr and use the C# DLLs....

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

Ben Voigt [C++ MVP] - 02 Aug 2007 18:30 GMT
>I have a lost of C# classes from many DLLs to use from my legacy C++ EXE
> application.
> Is there a generator that would use reflexion (for example) to generate a
> C++/CLI wrapper.

Can you not just compile with /clr and use the classes directly?
zolof - 02 Aug 2007 23:18 GMT
For the moment my MFC source code is compiled using VC++ 6.
Thanks to Microsoft, I cannot compile it using /clr.

I don't want to migrate because it cost a lot of efforts and because VS2005
does not generates the same exe. The exe will be bigger, slower to execute,
and not compatible with default libraies installed with Win98 and Win2000 (I
will need a new crt, mfc8.1 and atl8.1).
Also VS2005 is much slower to use and to compile than VC++6.
VS2005 is good only for .NET and specific C++ dev (like smart phone dev).

> >I have a lost of C# classes from many DLLs to use from my legacy C++ EXE
> > application.
> > Is there a generator that would use reflexion (for example) to generate a
> > C++/CLI wrapper.
>
> Can you not just compile with /clr and use the classes directly?
Pixel.to.life - 03 Aug 2007 01:04 GMT
> For the moment my MFC source code is compiled using VC++ 6.
> Thanks to Microsoft, I cannot compile it using /clr.
[quoted text clipped - 14 lines]
>
> - Show quoted text -

"I have a lost of C# classes from many DLLs to use from my legacy C++
EXE application."

I dont understand this statement. Your legacy C++ EXE aplication has a
lots of C# code???

Regardless, I faced a situation where I wanted to wrote GUI in a
managed forms application; and my core libraries were unmanaged C++.
I wrote simple managed wrappers around exposed classes from the
unmanaged libraries; so now I can keep legacy C++ code, and develop UI
in a managed way.

If that what you need, let me know, I will share how I did that.

[ http://groups.google.com/group/medicalimagingscience ]
zolof - 03 Aug 2007 08:22 GMT
I  have many .NET assemblies to be used by one legacy exe.
For the exe (VC++6) to be able to use the assemblies (C# 2.0), I need to
develop some wrapper DLLs (C++/CLI) since I don't want to use COM interop.

I am looking for a software that would use reflection to analyze my .NET
assemblies and generated the wrapper DLLs automatically.
I am sure this is possible and I will make ity myself if there is no way to
buy such a tool.
Ben Voigt [C++ MVP] - 03 Aug 2007 17:57 GMT
> For the moment my MFC source code is compiled using VC++ 6.
> Thanks to Microsoft, I cannot compile it using /clr.
[quoted text clipped - 6 lines]
> (I
> will need a new crt, mfc8.1 and atl8.1).

Creating managed wrappers and calling C# from C++ will introduce all the
issues mentioned here tenfold.  You'll need not only the updated CRT, but
also the entire .NET Framework installed.

Actually, VC2005 generates better code than VC6, your executable will be
smaller or faster (depending on what optimization settings you choose) just
by recompiling your standard C++ source code.  You can also statically link
the new CRT so you don't need to install it separately, but not if you want
to run managed code in the same application.

You really need to decide between avoiding the new CRT dependency and using
C#.  You can't have both.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.