Converting and Calling C++ DLL in C#
-
Hi, I am new to C# programming. I want to refer a DLL written in C++ (win32 DLL) in an application in C#. The Dll is in unmanaged code and my tester application is a C# application. I have read somewhere about using tlbimp to generate the metadata file. Can anyone tell me the process or any link which gives me information on this. Kindly help. Thanks Vini
-
Hi, I am new to C# programming. I want to refer a DLL written in C++ (win32 DLL) in an application in C#. The Dll is in unmanaged code and my tester application is a C# application. I have read somewhere about using tlbimp to generate the metadata file. Can anyone tell me the process or any link which gives me information on this. Kindly help. Thanks Vini
tlbimp.exe only works on COM servers with type libraries (typelibs). If you need to call native APIs that are exported from your DLL, you need to use P/Invoke. See Interoperating with Unmanaged Code[^] in the .NET Framework SDK for the differences between CCWs, RCWs, and P/Invoke, as well as click "Search comments" above. It's been discussed in this forum more times than you can imagine and there are also MANY articles about both types of interop here on CodeProject and across the 'net.
Microsoft MVP, Visual C# My Articles