1
votes

I've generated my libmodbus library with visual studio 2008. I can see the .dll and the .lib files.

Now in my project I can use this library if I configure my project:

  1. Linker Additional directories. (.lib folder)
  2. Additional libraries (.lib file)
  3. C/C++ Aditional directories. (Library code path)

With this steps everythings works fine.

But, is it possible to do the same without have the source code? Only with my generated .dll and .lib files?

1
Are you building the DLL itself? If so, then of course you need the source code to build it. Are you writing code that will use the DLL at runtime? Then you don't need any source code to the DLL -- all you need is the .lib import library. And even then, you don't need an import library, as using LoadLibrary and GetProcAddress allows you to call DLL functions at runtime.PaulMcKenzie
Thanks. I want to use the library withou use LoadLibrary. I can do it moving .lib .dll and .h files.Xabi E

1 Answers

1
votes

You do not need source files for use dll. All you need is .dll file. But in this case you should manually get address of every used function. Example for widows you can find here.

Getting address of every function is not very convenient. So you can use .lib file and header files (.h) (but not sources). In C/C++ Additional directories you should specify path to header files.

So you can configure your project:

  1. Linker Additional directories. (.lib folder)
  2. Additional libraries (.lib file)
  3. C/C++ Aditional directories. (Library headers path)