Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 105,763 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,703 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



What happen if managed code calls managed code with P/Invoke?

 
Reply to this topicStart new topic

What happen if managed code calls managed code with P/Invoke?

chronoTrigger
post 18 Jul, 2008 - 09:46 AM
Post #1


New D.I.C Head

*
Joined: 8 Oct, 2007
Posts: 40


My Contributions


I'm using the third party tool that's use to test unmanaged code. The tool is written in C# and build-in P/Invoke. I read somewhere that P/Invoke is used to help managed code calls unmanaged, so is it possible to call managed code from managed with P/Invoke?
User is offlineProfile CardPM

Go to the top of the page


born2c0de
post 18 Jul, 2008 - 11:52 PM
Post #2


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,716



Thanked 19 times

Dream Kudos: 2800

Expert In: C, C++, VB, VB.NET, C#, Java, x86 Assembly, Win32 API, Reversing

My Contributions


QUOTE
I read somewhere that P/Invoke is used to help managed code calls unmanaged,

Yes, that is true.

QUOTE
so is it possible to call managed code from managed with P/Invoke?

You can't call Managed Code Functions using the exact same code used to call unmanaged code functions because managed code functions aren't stored in the same format of a native code DLL file.

However, you can call the Managed Code functions directly by including a reference to the namespace which contains the function, provided it is declared as Public.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/21/08 01:43PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month