By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,706 Members | 2,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,706 IT Pros & Developers. It's quick & easy.

Accessing VC++ classes from .NET

P: n/a
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

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You’ve got a few options, listed below in order of appeal. First up though,
you cannot directly call or add a .CPP file to/from a C# application given
that they are two different languages, you can do so with some wrappers or
rewrites ala:

1. Depending on how your VC++ 6 DLL is structured, you can use P/Invoke to
access the methods and classes contained within from your C# app.

2. Add your .CPP file to a VC++.NET Class Library that is in turn referenced
by your C# application.

3. Rewrite your C++ code in C#.

Personally, I would suggest going with #1 as you already have the DLL built
and working.

Brendan
"ve*********@gmail.com" wrote:
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

Nov 17 '05 #2

P: n/a

<ve*********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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


There is no way to use C++ native classes directly from C#, the only
language that supports this scenario is VC++ .NET using it's Managed
Extentions (ME C++), but I would suggest you to wait for VS2005 C++/CLI to
become available (RTM November). Using ME C++ or C++/CLI you can author
managed classes that wrap your native classes, another option is to author
the tool using ME C++ or C++/CLI so you can directly access the native
classes (after recompiling the sources).
Willy.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.