C++ capability within C#

G

Guest

I have some background with C and C++ and am considering migration to Visual C#.NET for academic work. To get started, is it possible to compile working C++ code in the Visual C#.NET environment? If so, how is it done

Thanks in advance for any help.
 
S

Sam Gentile [MVP]

I assume that the existing C++ is unmanaged. Basically, C# cannot directly
call or consume native C++. However, Managed C++ can. It actually lets you
have unmanaged and managed in the same file! So what you can do is use MC++
to write a managed wrapper around your native C++. Then you can call it and
use it from C# (and any other CLR language). I did some articles on this a
while back for O'Reilly. See below. Its also in my book.

http://www.ondotnet.com/pub/a/dotnet/2003/03/03/mcppp2.html

--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.


David H. said:
I have some background with C and C++ and am considering migration to
Visual C#.NET for academic work. To get started, is it possible to compile
working C++ code in the Visual C#.NET environment? If so, how is it done?
 
R

Roy Fine

David H. said:
I have some background with C and C++ and am considering migration to
Visual C#.NET for academic work. To get started, is it possible to compile
working C++ code in the Visual C#.NET environment? If so, how is it done?
Nope -- that wont work -- While the C# language *may* be based somewhat on
C++, it's quite a different kettle of fish.

Your choices are at least these:
1) using managed VC++
2) leverage your C++ knowledge - and learn C#

Note : while C# is quite a different language, managed VC++ (for .Net
runtime environment) is somewhere in between - <grotesque>it ain't VC++ and
it ain't C#</grotesque>


regards
roy fine
 

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