Click here to Skip to main content
16,008,750 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
popopo9-Jul-03 1:57
popopo9-Jul-03 1:57 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor19609-Jul-03 5:18
igor19609-Jul-03 5:18 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
popopo9-Jul-03 9:26
popopo9-Jul-03 9:26 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 8:14
protectorHeath Stewart11-Jul-03 8:14 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 9:00
igor196011-Jul-03 9:00 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 9:11
protectorHeath Stewart11-Jul-03 9:11 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 9:28
igor196011-Jul-03 9:28 
GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
Heath Stewart11-Jul-03 9:43
protectorHeath Stewart11-Jul-03 9:43 
No, I get it - completely. P/Invoke could do it, yes, but it is RESTRICTIVE! He has to P/Invoke the unmanaged method in his managed code. Right there, that ties it to a specific DLL and that is the restrictive part. Then, in the managed code, he has to call that P/Invoke'd method. If he assumes that the method was found (i.e., the DLL exporting it is present) and, in fact, it wasn't found, the consequences could be bad if not handled right.

Trust me - I know how P/Invoke works. I get into the meat of .NET and have read all the documentation countless times. All I'm saying is that P/Invoke ties the code to one DLL.

Besides, you're also assuming that he has access to the source of the assembly. What if he's doing something in the .NET assemblies, part of the .NET framework. He can't add an external method and he can't make the message body call the P/Invoke'd method. A wrapper might be possible, but painful. My idea about instantiating a Delegate from unmanaged code (since it implements IDispatch, calling its methods are easy) and passing that to the callback parameter of whatever he's calling. He would still be to have a small assembly (or emit one) that receives the callback. Using your idea in that might work, but hard-coding it into the "target" assembly (if he can even change the assembly) isn't necessarily a good idea. If he can insure that these two assemblies will always be present together and that he doesn't want to ever replace the unmanaged DLL, sure it might work. Frankly, I just don't swing that way because I like to make my code versatile, instead of paying for it later.

 

Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN

GeneralRe: How to make callback from hosted managed component to unmanaged host? Pin
igor196011-Jul-03 10:40
igor196011-Jul-03 10:40 
QuestionHow to make callback from hosted managed component to unmanaged host? Pin
popopo8-Jul-03 16:17
popopo8-Jul-03 16:17 
AnswerRe: How to make callback from hosted managed component to unmanaged host? Pin
igor19608-Jul-03 21:15
igor19608-Jul-03 21:15 
AnswerRe: How to make callback from hosted managed component to unmanaged host? Pin
leppie9-Jul-03 7:25
leppie9-Jul-03 7:25 
QuestionMath Namespace? Pin
igor19608-Jul-03 14:52
igor19608-Jul-03 14:52 
AnswerRe: Math Namespace? Pin
J. Dunlap8-Jul-03 17:41
J. Dunlap8-Jul-03 17:41 
AnswerRe: Math Namespace? Pin
leppie8-Jul-03 18:26
leppie8-Jul-03 18:26 
GeneralRe: Math Namespace? Pin
igor19608-Jul-03 19:55
igor19608-Jul-03 19:55 
AnswerRe: Math Namespace? Pin
James T. Johnson9-Jul-03 6:12
James T. Johnson9-Jul-03 6:12 
GeneralRe: Math Namespace? Pin
leppie9-Jul-03 7:17
leppie9-Jul-03 7:17 
GeneralRe: Math Namespace? Pin
Not Active9-Jul-03 8:14
mentorNot Active9-Jul-03 8:14 
GeneralRe: Math Namespace? Pin
leppie9-Jul-03 8:28
leppie9-Jul-03 8:28 
GeneralRe: Math Namespace? Pin
Not Active9-Jul-03 9:08
mentorNot Active9-Jul-03 9:08 
GeneralRe: Math Namespace? Pin
igor19609-Jul-03 7:21
igor19609-Jul-03 7:21 
GeneralRandom Number generation PROBLEM Pin
Member 4648617-Jul-03 9:49
Member 4648617-Jul-03 9:49 
GeneralRe: Random Number generation PROBLEM Pin
leppie7-Jul-03 10:08
leppie7-Jul-03 10:08 
GeneralRe: Random Number generation PROBLEM Pin
chris lasater7-Jul-03 10:29
susschris lasater7-Jul-03 10:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.