Platform Invocation Services - Tools

Tools

There are a number of tools which are designed to aid in the production of P/Invoke signatures.

Writing a utility application that would import C++ header files and native DLL files and produce an interface assembly automatically turns out to be quite difficult. The main problem with producing such an importer/exporter for P/Invoke signatures is the ambiguity of some C++ function call parameter types.

Brad Abrams has this to say on the subject: The P/Invoke Problem.

The problem lies with C++ functions like the following:

__declspec(dllexport) void MyFunction(char *params);

What type should we use for the parameter params in our P/Invoke signature ? This could be either a C++ null terminated string, or could be a char array or could be an output char parameter. So should we use string, StringBuilder, char or ref char ?

Regardless of this issue, there are a few tools available to make the production of P/Invoke signatures simpler.

One of the tools listed below, C#/.NET P/Invoke Interop SDK has actually successfully resolved this issue by implementing multiple overrides of the same C++ method in .NET world, developers can then pick the correct one to make the call.

Read more about this topic:  Platform Invocation Services

Famous quotes containing the word tools:

    In child rearing it would unquestionably be easier if a child were to do something because we say so. The authoritarian method does expedite things, but it does not produce independent functioning. If a child has not mastered the underlying principles of human interactions and merely conforms out of coercion or conditioning, he has no tools to use, no resources to apply in the next situation that confronts him.
    Elaine Heffner (20th century)

    The study of tools as well as of books should have a place in the public schools. Tools, machinery, and the implements of the farm should be made familiar to every boy, and suitable industrial education should be furnished for every girl.
    Rutherford Birchard Hayes (1822–1893)

    There is a great satisfaction in building good tools for other people to use.
    Freeman Dyson (b. 1923)