Accessing Existing Vc++ API from .NET C# or VC++.NET

V

vemulakiran

Hi all,
I have doubt regarding .NET.
I have a tool which was developed on VC++ 6.0(Win32 Application ).
The application communicates with library (API) which was developed on
VC++ 6.0 called core client.
I am planning to develop the tool or Win32 application on .NET
platform and I dont' want to migrate the VC++ library (API) to .NET.
The new .NET tool should use the previous VC++ library API ( core
client ).
Is there any possibility to call VC++ 6.0 source file ( .CPP ) or
APIs from .NET ( C# or VC++.NET )..? IF so, would u please suggest me a
usefull link or tell me How can I do it. I dont' want to make the
existing VC++ core client into DLL and add it as a reference to .NET
project.

Thanks for you kindly help
Regards
Kiran
 
W

William DePalo [MVP VC++]

I have doubt regarding .NET.
I have a tool which was developed on VC++ 6.0(Win32 Application ).
The application communicates with library (API) which was developed on
VC++ 6.0 called core client.
I am planning to develop the tool or Win32 application on .NET
platform and I dont' want to migrate the VC++ library (API) to .NET.
The new .NET tool should use the previous VC++ library API ( core
client ).
Is there any possibility to call VC++ 6.0 source file ( .CPP ) or
APIs from .NET ( C# or VC++.NET )..? IF so, would u please suggest me a
usefull link or tell me How can I do it. I dont' want to make the
existing VC++ core client into DLL and add it as a reference to .NET
project.

Well, IMO, the most straight-forward thing to do is to expose a DLL
interface to the library. That done, you can use the facility known as
Platform Invoke from C# as described here:

http://msdn.microsoft.com/library/d...us/csref/html/vcwlkplatforminvoketutorial.asp

and here:

http://msdn.microsoft.com/library/d...ide/html/cpconacloserlookatplatforminvoke.asp

Alternatively you can use Managed C++ (or C++/CLI if you use VS.Net 2005 in
beta now) to create a managed class which can take advantage of what is
called "It just works" (aka IJW) which describes the ability of managed C++
to call unmanaged C++ almost by magic. No other .Net language lets you do
that. That done, your managed C++ class can be consumed by C# clients or
VB.Net clients or any other managed client.

There are issues, however, in developing mixed mode applications. See this
for the details:

http://msdn.microsoft.com/library/d...stechart/html/vcconMixedDLLLoadingProblem.asp

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top