0

I have to write a code in C++ (with Qtcreator). For that I have to use a dll from a supplier but I don't have the .lib file and the .h file.

But with the dll I had an example code in visual studio which work. But no .lib nor .h file in the project. I guess visual doesn't need those files?

I used dotPeek to decompile the dll file and tried to recompile it in visual studio to create a .lib file and .h file. But I'm not familiar with visual studio and didn't succeeded to manage dependencies I guess, and got errors.

Do you think I can get My .lib and .h file by recompile the dll? Or maybe there is a way to do this with the example code? Have you some lead for me? Do you need more info?

Thank you.

  • Depends on the DLL. If it's a COM component, you may be able to pull some tool-specific magic that'll do most of the work for you. [Otherwise is this answer any help?](https://stackoverflow.com/a/554601/4581301) Good documentation for the DLL will eliminate the first two steps. – user4581301 Jul 07 '21 at 18:10
  • Thank you for your comment. I saw before the loadlibrary and getprocaddress methodes but searched for easyer way. I think I will try it anyway. Just to know, how visual studio can use the dll namespace without thoses methods? It's is own little secret? – Frederic Funky Jul 07 '21 at 19:50
  • Visual Studio often surprises me with the little helpful tools they built in, but I almost never use it for anything but the debugger because the text editor and navigation tools rub me the wrong way. End result is I don't know its features as well as I probably should. – user4581301 Jul 07 '21 at 19:56
  • I can have the .h file and a .so file for linux coding. Is there a way to convert the .so to .lib? – Frederic Funky Jul 07 '21 at 20:02
  • Along with the .so file in linux there is often a .a file doing the same thing as the .lib. Otherwise you dynamically link the hard way. I can guarantee you that someone has written a tool to read a DLL and produce a .lib file. Why? Because I remember tools for Delphi that would produce the Delphi equivalent of a .lib to make your life as a Delph coder easier. Someone will have automated this task for the C and C++ worlds, but I don't know who or if they released it. – user4581301 Jul 07 '21 at 20:14
  • Unfortunately, supplier doesn't give the .a file. I searched for a way to extract .lib from dll but without success. dumpbin tool from visual studio didn't help. I'll try the loadlibrary way and hope it can do the job. Thank you. – Frederic Funky Jul 07 '21 at 20:56

0 Answers0