Getting a driver to work in a managed environment
-
Hi all, I have a simple driver which compiles and loads fine, and a simple C++ application which can read data being output from it. What I am ultimately trying to do is get the data being spat out from the driver into a C# application (which I would prefer to use to do the GUI side of things). My plan at the moment is to create a .dll, which would have the C++ code to read from the driver, and a buffer which would be exposed to the C# application to read the data. I have not got to the point of trying this yet, but from what I have been reading online I get the impression that mixing managed and unmanaged code is a nightmare. So I have two questions: #1. Am I on the right track with this plan of mine? #2. If I am not on the right track, does anyone who has been through all of this have any tips, or good articles that can get me moving in the right direction? Thankyou, Mark.
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
-
Hi all, I have a simple driver which compiles and loads fine, and a simple C++ application which can read data being output from it. What I am ultimately trying to do is get the data being spat out from the driver into a C# application (which I would prefer to use to do the GUI side of things). My plan at the moment is to create a .dll, which would have the C++ code to read from the driver, and a buffer which would be exposed to the C# application to read the data. I have not got to the point of trying this yet, but from what I have been reading online I get the impression that mixing managed and unmanaged code is a nightmare. So I have two questions: #1. Am I on the right track with this plan of mine? #2. If I am not on the right track, does anyone who has been through all of this have any tips, or good articles that can get me moving in the right direction? Thankyou, Mark.
Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
1. Yes, this is probably the best way to do it. 2. The P/Invoke[^] tutorial should help in designing your DLL. See also this article[^] by Luc Pattyn[^].
-
1. Yes, this is probably the best way to do it. 2. The P/Invoke[^] tutorial should help in designing your DLL. See also this article[^] by Luc Pattyn[^].