Calling Managed Code From Unmanaged Code

I am working on an MDI application written in Delphi.  All the child documents are in DLL's.  The names of the DLLs are stored in the database so that they can be dynamiclly added into the system.  The all except the same parameter when they are instantiated, an ADO connection string to the database.  Is it possible to write the child documents in C#, compile them into DLL's, and call them from the Delphi parent document without modifing the parent application?
DMSINTLAsked:
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.

c_myersCommented:
"Without modifying the parent app" no.

You cannot create "standard" Win32 DLL's from C# (with the ol' _cdecl or stdcall-type stuff).


Now, with C++ and Managed Extensions, you might be able to do this. If you want to head down that road, I can get you started, but not much further since that's pretty complicated and hairy stuff.
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
existenz2Commented:
Here's an tutorial on how you can do calls on managed code from unmanaged: http://www.codeproject.com/dotnet/bridge.asp
0
c_myersCommented:
Yeah, what he said. :)

You have to be careful though, sometimes you can get into a situation where the CLR isn't loaded at the right time. For *most* purposes that should work, but sometimes you have to actually hook into the DLL init stuff and handle the CLR initialization manually. That gets ugly.
0
c_myersCommented:
I think he (existenz2) should get more of the points (maybe 25/75 me/him)? His answer was more useful. Mine was mostly a "Me too" answer.
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
Fonts Typography

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.