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 2006

Tip: Looking for answers? Try searching our database.

Converting VC++ 6.0 executable code to .Net DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 26 Aug 2006 16:32 GMT
Hi,

I wish to convert c++ code written using VC++ 6.0 to the .Net development
environment (Visual Studio 2005).  

So far I have copied the code into a new C++ Class Library project and
recompiled it.  I got some errors from the linker and had to change the
configuration of the project to use the MFC as a shared dll even though the
code is mostly pure C++ - I guess there must be a reference somewhere.  

Anyhow, the environment generated a main class for me, shown below, as
probably was expecting managed c++ code.  

My problem is that I do not know how to export the interfaces my client C#
code would be interested in.  Only the generated class is visible and the
C++ classes are not visible from within this class.  The c++ code does not
belong to any namespace, as is just a large collection of classes developed
a while ago.  

What would I need to do to export my C++ interfaces?  

Can anyone provide a mini example of unmanaged C++ code compiled in visual
studio 2005 being called from a C# program?

Thanks in advance.

#pragma once

using namespace System;

namespace Project1 {

    public ref class Example
    {
        // TODO: Add your methods for this class here.
    };
}
Carl Daniel [VC++ MVP] - 26 Aug 2006 18:07 GMT
> Hi,
>
[quoted text clipped - 20 lines]
> Can anyone provide a mini example of unmanaged C++ code compiled in
> visual studio 2005 being called from a C# program?

Google is your friend.

Here are a couple of places to start:

http://www.codeproject.com/useritems/usingcppdll.asp

http://www.codeproject.com/useritems/WrappingUsingManagedCpp.asp

-cd

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.