dll linking

How do i link a dll? I tried few examples from the decumentation, but completely useless, no real world examples on how to load the library…

I tried to do add this in the cmakelist
target_link_libraries(project_name C:/Users/username/libabcd.dll)
But errors occur, when i try to use it.

On windows you don’t link the shared object but the import library. That means you need to link to the associated “libabcd.lib”. The dll must be in your PATH (or one of the known directories) when you run your program then.

And how to link that lib?

target_link_libraries(target_name C:/Users/username/libabcd.lib)
Remarks:

  1. It may be in a different path - you have to find the right file yourself.
  2. Hardcoding paths is actually a bad idea