473,473 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

P/Invoke explanation

Hi all,

On more than one occasion I stumbled upon an explanation here that
talks about the 'P/Invoke layer'. Although I've got a general idea
what it's about, I'm having trouble grasping what it really means.
Because I suspect I'm not the only one with these questions, here they
are on a single, new newsgroup thread:

- Can someone define what the "P/Invoke layer" is/means?
- Are there any good introductory (!) articles on this subject?

Thanks, regards,
Jeroen
Jan 7 '08 #1
7 1998
* * P/Invoke (short for platform invoke) is a term used to describe calling
functions exported from DLLs (native code, and not COM objects, that's COM
interop).
And u cant use them calling java programs... please tell me I´m wrong.
looking for just that
Jan 7 '08 #2
Hi,
Did you google it?
I just enter P/invoke and the two first article are a good source of help.

In short P/Invoke is the feature in .NET that allows you to call unmanaged
(native WIN32) code.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Jeroen" <me******@gmail.comwrote in message
news:98**********************************@d4g2000p rg.googlegroups.com...
Hi all,

On more than one occasion I stumbled upon an explanation here that
talks about the 'P/Invoke layer'. Although I've got a general idea
what it's about, I'm having trouble grasping what it really means.
Because I suspect I'm not the only one with these questions, here they
are on a single, new newsgroup thread:

- Can someone define what the "P/Invoke layer" is/means?
- Are there any good introductory (!) articles on this subject?

Thanks, regards,
Jeroen

Jan 7 '08 #3
What, call native DLL functions from Java programs? I don't believe
that is the case. I believe that you can make calls to native DLLs through
JNI.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ch*******@gmail.comwrote in message
news:e2**********************************@v46g2000 hsv.googlegroups.com...
P/Invoke (short for platform invoke) is a term used to describe calling
functions exported from DLLs (native code, and not COM objects, that's COM
interop).
And u cant use them calling java programs... please tell me I´m wrong.
looking for just that
Jan 7 '08 #4

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:uW**************@TK2MSFTNGP05.phx.gbl...
What, call native DLL functions from Java programs? I don't believe
that is the case. I believe that you can make calls to native DLLs
through JNI.
He said calling Java programs... presumably calling Java from .NET.

I know that with the Microsoft VM every Java class becomes a COM component,
so you could use COM interop. Though that's not likely to work with any
other VM, such as Sun.
>

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ch*******@gmail.comwrote in message
news:e2**********************************@v46g2000 hsv.googlegroups.com...
>P/Invoke (short for platform invoke) is a term used to describe calling
functions exported from DLLs (native code, and not COM objects, that's
COM
interop).

And u cant use them calling java programs... please tell me I´m wrong.
looking for just that

Jan 7 '08 #5
ch*******@gmail.com wrote:
> P/Invoke (short for platform invoke) is a term used to describe calling
functions exported from DLLs (native code, and not COM objects, that's COM
interop).

And u cant use them calling java programs... please tell me I´m wrong.
looking for just that
True.

..NET--(P/Invoke)--C--(JNI)--Java

or one of the other work arounds.

If you are willing to stretch things a bit, then http://www.ikvm.net/ !

Then you can actually run Java code within .NET - I may not want
to have an important project depend on it, but just for fun I tried
using it to call the Oracle thin JDBC driver from C# - it worked
fine.

Arne
Jan 8 '08 #6
I read christery as going the other way, C# -Java. There is probably a way
with CORBA, but I usually just wrap the java codes as an app with an
input/output file API.

"Nicholas Paldino [.NET/C# MVP]" wrote:
What, call native DLL functions from Java programs? I don't believe
that is the case. I believe that you can make calls to native DLLs through
JNI.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ch*******@gmail.comwrote in message
news:e2**********************************@v46g2000 hsv.googlegroups.com...
P/Invoke (short for platform invoke) is a term used to describe calling
functions exported from DLLs (native code, and not COM objects, that's COM
interop).

And u cant use them calling java programs... please tell me I´m wrong.
looking for just that
Jan 8 '08 #7
Here are some articles that use P/Invoke to achieve various (fun) tasks with
C# beginners in mind:

http://www.geekpedia.com/tutorial176...nd-volume.html
http://www.geekpedia.com/tutorial219...rom-Files.html
http://www.geekpedia.com/tutorial177...d-Log-Off.html
http://www.geekpedia.com/tutorial209...Wallpaper.html
http://www.geekpedia.com/tutorial146...ordinates.html
http://www.geekpedia.com/tutorial210...nput-Time.html
http://www.geekpedia.com/tutorial218...ng-Csharp.html
http://www.geekpedia.com/Question122...Lock-keys.html

Quite a few, eh? When you need to interact with the operating system
especially, you'll be using P/Invoke a lot, but with each new version of
..NET more functions are implemented as managed functions into the framework,
so you don't have to deal with this.

Let me know if you have questions.
"Jeroen" <me******@gmail.comwrote in message
news:98**********************************@d4g2000p rg.googlegroups.com...
Hi all,

On more than one occasion I stumbled upon an explanation here that
talks about the 'P/Invoke layer'. Although I've got a general idea
what it's about, I'm having trouble grasping what it really means.
Because I suspect I'm not the only one with these questions, here they
are on a single, new newsgroup thread:

- Can someone define what the "P/Invoke layer" is/means?
- Are there any good introductory (!) articles on this subject?

Thanks, regards,
Jeroen
Jan 8 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Altland | last post by:
Here is my basic problem. I have a form that executes a cpu instensive algorithm occupying the first thread. When the algorithm is executed another form pops up telling the user the progress that...
10
by: Momchil Velikov | last post by:
The following program produces error at the definition of ``b''. However it compiles fine the second (supposedly equivalent) form of the templated constructor. Why the two alternatives aren't...
2
by: Tom | last post by:
Hi Everybod I want to update some controls in a form from another threads. I did it by passing the form to that thread and calling a delegate with Form1.Invoke, I want to have just one delegeate...
3
by: David Logan | last post by:
I have an application using sockets, and it uses the asynchronous method for receiving (and others, but receiving is the basic problem.) In short, I want: class someClass: Form {...
6
by: Bob Kline | last post by:
We have run into a problem trying to build a client which works with a web service implemented against the WSDL at . We have successfully created clients using other tools than the DotNet...
23
by: Thomas Due | last post by:
Hi, I have a class which monitors a TCP socket. This will on occasion raise an event which can be handled by a GUI. Now, I am aware of the if(InvokeRequire) { EventHandler d = new...
4
by: Dan Soendergaard | last post by:
Hello fellow developers, I've created a control which derives from the .NET TextBox. I then wanted to add two events to the new control, so I added the following to the control code: public...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
2
by: LVP | last post by:
Hello, How does Control.Invoke(delegate) work? Executes the specified delegate on the thread that owns the control's underlying window handle I am looking for Underthehood explanation. How...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.