Share via


How to use .lib files in C#

Question

Wednesday, December 10, 2008 4:25 AM

Hi,

Please provide me some sample code for the following requirement:

I have a .lib file having real logic, i want to use the functions of that .lib file in my C# application.

I am not having the source code of the .lib file.

Thanks,

kartheek

All replies (5)

Wednesday, December 10, 2008 4:50 AM ✅Answered

About the best I can suggest is to create a wrapper in C++.  You can create either a standard dll wrapper which you can use from C# via P/Invoke, create a COM wrapper which you can use in C# via COM Interop, or create a C++/CLI dll that you can use just like any other .NET library...

HTHTom Shelton


Thursday, December 11, 2008 7:55 PM ✅Answered

Ok... here it is:

http://tomshelton.wordpress.com/2008/12/11/creating-a-managed-wrapper-for-a-lib-file/

HTHTom Shelton


Wednesday, December 10, 2008 5:11 AM

Hi,

Thanks for the info.

Please give me some sample code for creating a standard dll wrapper from the .lib file.

Thanks,

kartheek


Wednesday, December 10, 2008 8:08 AM

Kartheek...

I've put together a simple example.  I'm writting up a walk through, and will post it to my blog.

HTHTom Shelton


Thursday, December 11, 2008 5:09 AM

Please let me know once you are done with writting the walk through.