C# C++ integration

N

narmathabala

Hello,

I am a novice in the .net platform. Please help in this.
I have a C++ application which, now will have to be integrated in to
ASP.net for a web application. I understand that .NET Framework
programs can access native code libraries by means of static DLL entry
points.
I would like to know if there are any other means wherein the asp web
application can use the c++ code.

Thanks in advance,
Narmatha
 
B

Bruno van Dooren

you could compile the C++ code into a normal managed .NET dll instead of a
native dll by specifying the /clr switch.
that way your ASP .NET application could use that .NET dll without having to
support an interface to a native dll.

right click on your project, select configuration properties -> general and
set 'use managed extensions' to yes.

see
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vccore/html/vcrefEECOMCompilation.htm
for more details.

kind regards,
Bruno.
 
B

Bronek Kozicki

I have a C++ application which, now will have to be integrated in to
ASP.net for a web application. I understand that .NET Framework

get Visual C++ 2005 Express for free
http://msdn.microsoft.com/vstudio/express/visualc/download/default.aspx
and try to compile your code as C++/CLI and see if it works. You will
need to update "class" to "ref class" whenever you want to see it (type
definition) in ASP.NET. Be aware that "ref class" is not C++ , it is
different language called C++/CLI which is backward-compatible with C++
.. It's similar story like C and C++ : almost all programs written in C
(C++) are valid when compiled as C++ (C++/CLI) , but C++ (C++/CLI)
programs are not valid C (C++) .


B.
 
N

narmathabala

Thanks a lot for the replies.

There is another question in this regard.
Will the performance of the C++ application deteriorate when C++ code
is compiled as a normal managed dll.
 
G

Guest

there should be little to no difference in application performance.

kind regards,
Bruno.
 
B

Bronek Kozicki

There is another question in this regard.
Will the performance of the C++ application deteriorate when C++ code
is compiled as a normal managed dll.

You do not know until you try. Performance, especially in C++, is fuzzy
issue that depends on many things like code, compilatio options, usage
patterns etc. It is estimated that you might lose few %, but you might
as well gain something, as managed heap in .NET is faster than
non-managed one (this comes at the cost of lost of freedom of using
pointers).


B.
 

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