how to use an old C++ window application in my asp.net web project?

C

Cindy

Hello everyone thanks for reading.
I have an old C++ windows application working as a stand alone
calculater to compute some very complicated physical chemistry stuff. I
dont have any documentation on it, only a calculater.cpp file,
caluclater.h and an .exe file which I tested was the correct executable
file generated by the c++ file.
I need to build a web application(VB.net or C#.NET using VS2005), while
this calculater program needs to read several user input and return
several values from it. (it works as a validation tool, the data user
submitted to the forms need to go through this calculater program to
check if the configuration/values are valid or not, if not valid I'll
let user reselect some configuration and run this calculater again).
My question is: how do I use this C++ code? Should I make a DLL of
it?(that seems like the best choice so far after days of research). If
that' the case, how do I do that? I really need details, new to .NET,
and didn't work on c++ for quite a while.
your help is GREATLY appreciated!! especially step by step kind of
details:)
Thanks a bunch!
 
M

MrAsm

Hello everyone thanks for reading.
I have an old C++ windows application working as a stand alone
calculater to compute some very complicated physical chemistry stuff. I
dont have any documentation on it, only a calculater.cpp file,
caluclater.h and an .exe file which I tested was the correct executable
file generated by the c++ file.
I need to build a web application(VB.net or C#.NET using VS2005), while [...CUT...]
My question is: how do I use this C++ code? Should I make a DLL of
it?(that seems like the best choice so far after days of research). If

I think there are several options for you:

a. Build a DLL with a C interface, as a wrapper to your existing C++
code, and call this DLL from C#/.NET

b. Build a C++ COM object as a wrapper to your existing C++ code, and
call it via C#/.NET

c. Re-Compile your C++ code with a modern Microsoft Compiler, like
Visual Studio .NET 2003 or 2005. Microsoft added extensions to C++
compiler, to produce so called "managed code". You can call this code
from C# or other languages in .NET world.

d. Port your C++ code to C#.
If your .cpp code is only a single source file, I think that porting
from C++ to C# should not be much difficult (you will enjoy the
process :) e.g. convert all the :: or . or -> from C++ to the simple
"." common C# dot-notation; or simply dynamically allocating objects
and don't pay attention to delete them to avoid memory leaks, etc.)

Hope it helps,
MrAsm
 
K

Kürsat

If you know COM pogramming you can build a COM object and expose existing
functionality over this object. Then you can load and use this object from
your web project. COM programming (including ActiveX and OLE) is very
complex topic but you can easily find many resources by searching web about
COM programming, using COM with web applications, .NET framework etc.

Another solution may be translating C++ code to C# or VB.NET and directly
use in your web application.
 

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