?
Solved

Calling Managed Code From Unmanaged Code

Posted on 2006-03-29
6
Medium Priority
?
251 Views
Last Modified: 2013-12-03
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?
0
Comment
Question by:DMSINTL
  • 3
4 Comments
 
LVL 4

Accepted Solution

by:
c_myers earned 500 total points
ID: 16329628
"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
 
LVL 14

Assisted Solution

by:existenz2
existenz2 earned 500 total points
ID: 16329712
Here's an tutorial on how you can do calls on managed code from unmanaged: http://www.codeproject.com/dotnet/bridge.asp
0
 
LVL 4

Expert Comment

by:c_myers
ID: 16329739
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
 
LVL 4

Expert Comment

by:c_myers
ID: 16619539
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question