How to use my DLL writen by Visual C++ in ASP.NET?

Dear Experts:

I have a toolkit that is DLL writen in Visual C++.

Now I want to write web application in ASP.NET and want to invocate the functions in DLL.

I did some research and didn't find too much information on how to code ASP.NET using DLL.

Could anybody give me help, give me some links or tutorials?

Your help is highly appreciated!
-Southmountain
southmountainAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

drichardsCommented:
You have a few choices.  If it is a COM dll, you can use it directly from .NET.  Otherwise, you can write a managed C++ wrapper around the dll to expose the functionality in .NET form or you can use the PInvoke mechanism to call directly into the C++ dll from .NET.  Do you have an idea which of these options seems preferable?  If you don't have a COM dll, which seems to be the case from your brief question, then you would be looking at one of the other two options.  A managed wrapper is cleaner but may be more work depending on how much functionality is exposed by the dll.

The two non-COM options are described here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp.

What do you think?  A few more details of your dll will be helpful in figuring out the easiest path.
0
southmountainAuthor Commented:
Dear Experts:

I forgot to tell you that I have full source code for this DLL.
Do I have other options such as recompile it in Visual C++.NET?

If it is good choice I might considering migrating to Visual C++.NET.
Thanks,
-southmountain
0
drichardsCommented:
Recompiling does not really help you.  Your options are still the same as I outlined previously.  Converting to managed C++ helps, but that is a lot more than merely recompiling.  Have a look at the managed extensions in VC++ .NET - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcconMCOverview.asp.  This would also be used to write a managed wrapper for the dll.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

southmountainAuthor Commented:
Thanks a lot for your comments.

I am not sure if it is a COM DLL. based on my document, I should copy this DLL to
my \WINNT\SYSTEM32 directory.

Based on your suggestion and I do write a managed C++ wrapper, how can I use it in ASP.NET?
Any more links for demo? my final goal is to write a web application.

Thanks,
-Southmountain

0
Svetlin_PanayotovCommented:
Take a look here
http://www.codeproject.com/aspnet/ExportClassLibrary.asp
The DLL is implemented in C# - but it's just the same - when you write the wrapper for your unmanaged DLL - you can call it like in this demo.

Svetlin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
drichardsCommented:
You use the managed wrapper from ASP.NET just like you use any other assembly in .NET.  You add a reference to the managed dll to your web app project and then you have access to the components in the library.  Just right click on "References" in the Solution Explorer, select the ".NET" tab and then browse for the wrapper library file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.