Re: Converting VC++ 6.0 executable code to .Net DLL

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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/WrappingUsingManagedCpp.asp

-cd


.



Relevant Pages

  • Re: Expert System in C#
    ... And your partner would have the opportunity to improve her programming language knowledge. ... If she can use Visual Studio, then she can write a managed DLL in C++. ... If she is only able to use some other development environment, or for whatever reason is unwilling to learn _anything_ new about managed code, then she can compile her code as a DLL and then your code can use p/invoke to call it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Good lord, when do I get to actually program?
    ... fortunate to be starting with C# and the .NET Visual Studio: ... Use what the development environment gives you for ... It's never clever to make things complicated: ... sit down in front of Visual Studio and code. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Are there graphical editors for non-visual object development?
    ... > Is there a development environment where you can do object-oriented ... > then edit each of those objects to write code? ... > similar to an IDE like PowerBuilder or Visual Studio which allows us ... > code generation and all that, just a lightweight editor for writing ...
    (comp.object)
  • Installed Symantec/Norton Internet Security 2005 and can no longer run IIS
    ... I have tried to switch off all options for Symantec/Norton Internet ... Contacting server to open Web project ... I can start visual studio on any forms application. ... MS Development Environment 2003 V7.1.3088 ...
    (microsoft.public.inetserver.iis.security)
  • Re: Newbie: Deployment errors on PPC
    ... ActiveSync after you have installed Visual Studio. ... > The development environment is VS.Net 2003. ... > Error: Cannot estabilish a connection. ...
    (microsoft.public.pocketpc.developer)