PC Review


Reply
Thread Tools Rate Thread

Converting VC++ 6.0 executable code to .Net DLL

 
 
Jason
Guest
Posts: n/a
 
      26th Aug 2006
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.
};
}
 
Reply With Quote
 
 
 
 
Carl Daniel [VC++ MVP]
Guest
Posts: n/a
 
      26th Aug 2006
Jason wrote:
> 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?


Google is your friend.

Here are a couple of places to start:

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

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

-cd


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restore Kernel32.dll dnsapi.dll powrprof.dll and wininet.dll Durward Rogers Windows XP Security 1 12th Dec 2009 11:27 PM
Re: The Logon User Interface DLL Msgina.dll failed to load. Contactyour system administrator to replace DLL or restore the original DLL. John John (MVP) Windows XP Help 0 9th May 2008 05:55 PM
One executable program send message to another executable program =?Utf-8?B?SkRI?= Microsoft Dot NET Framework 4 26th Aug 2007 05:08 PM
Error: Task executable could not be run. Executable not a valid Win32application !? Firona Microsoft C# .NET 0 14th Jan 2007 11:00 AM
how to catch the return code of one VB.Net executable from another VB.net executable =?Utf-8?B?bGlicw==?= Microsoft VB .NET 14 5th May 2004 10:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 AM.