I have a header file and a .lib file created using C++.
Now I want to use it in a C# program. Is this possible?
For a static library, the . lib file contains obj files. Each obj file is the output of one and only one compiler source code input file. A lib file is just a collection of related obj files, much like putting obj files in a directory. That is essentially what a lib file is, a library of obj files.
To load the LIB file, select File → Load Library..., navigate to the location of your LIB file, select the file, and click Open.
LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with LINK when building a program.
You can create a managed wrapper, see step by step instruction here:
http://tom-shelton.net/?p=95
There's not a traditional linker to let you import the lib. Your best bet is to compile to a COM library and use interop to use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With