Reputation: 51
My company uses a third-party C++ DLL which is updated periodically. I've been manually creating C# DLLImport statements, but in this last update the number of functions nearly doubled. Is there any tool (preferably free) that will create C# DLLImport's from an unmanaged C++ .dll or .lib file? (The DLL exports decorated C++ functions, not C++ class).
Upvotes: 2
Views: 2498
Reputation: 5836
As far as I know such a tool does not exist. You must write the P/Invoke declaration for each function yourself. I think its just as well since C++ functions are usually full of subtleties including in/out context, c-style strings, c-style arrays, pointers, references and what not. Many times the expected input/output can only be expressed by documentation and a tool cannot possibly output correct marshalling declarations for the functions.
Upvotes: 0
Reputation: 176169
Microsoft's Managed, Native, and COM Interop Team provides some tools on Codeplex, amongst them a tool called
I haven't tried it myself, but it looks as if it can do what you are looking for.
Upvotes: 2