The P/Invoke Wizard
"What is the P/Invoke Wizard?
I wrote the P/Invoke Wizard to save time for both myself and my co-author, David Durant, while we were writing our .NET Compact Framework books. I wrote this tool because I found that P/Invoke declarations were both tedious and error prone when done by hand. Now with a few clicks of my mouse, I get complete and correct declarations in a fraction of the time it previously took. My company started selling the P/Invoke Wizard in 2002. Since finishing my books, I have been able to make some time to update the tool - and now version 1.3 is available.
The P/Invoke Wizard is a tool that automates the process of writing declarations in managed code for calling into unmanaged DLLs. With just a few mouse clicks, the P/Invoke Wizard can opens a C or C++ include file and create thousands of .NET-compatible P/Invoke declarations in a choice of C# or Visual Basic .NET. The wizard can be set for compatibility with either the .NET Compact Framework or the .NET Framework.
...
How Does The P/Invoke Wizard Work?
P/Invoke works by reading C/C++ include (.H) files. The P/Invoke processing engine takes the various declarations and produces a compatible .NET version in your choice of C# or Visual Basic .NET.
P/Invoke understands the following kinds of C/C++ declarations:
#define statements for integer and string constants
enum statements that define enumerated constant values
typedef struct declarations that define the layout of structures
typedef declarations for custom data types
union statements
function prototypes
The P/Invoke Wizard converts #define constants into the equivalent C# or VB.NET declarations. It converts C/C++ data structure definitions and converts them into the equivalent .NET data structures. It also reads C/C++ function prototypes and generates the equivalent function.
...
P/Invoke Wizard Limitations
Version 1.3 of the P/Invoke Wizard relies on information found in include (*.H) files. So if you do not have the include file, then P/Invoke cannot help you. It does not, for example, use the binary DLL file for input. Nor does the P/Invoke Wizard use a COM Type Library. In short, you need include (*.h) file declarations. Another limitation is that this tool does not accept executable C++ statements -- function calls, loops, etc.
What it *does* provide is a shortcut when you have a lot of native code declarations that you need to access from managed code. ...."
This $59.95 tool sounds interesting. I downloaded the demo and pointed it at a couple *.H files and it seemed to translate them with no problems. The next time I need to do some header file translations, I'm checking this utility out in detail...
(via pinvoke.net: Helpful Tools (misc))
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...