This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What is the difference between nrf-ble-driver-sd_api_v6-mt-4_1_1.lib and nrf-ble-driver-sd_api_v6-mt-static-4_1_1.lib?

I first assumed the obvious that the first library would be used with the (Visual studio) multi-threaded DLL/MD option and the second would be used with the multi-threaded/MT option. However, I can only build with the multi-threaded DLL/MD option and I only use the static library. I do not include the other library.

I would like to build a stand-alone exe that does not depend upon MS redistributables.

  • How would I build a static exe that does not depend upon MS redistributables (everything else I have does NOT require redistributables)?
  • How are the two different libraries used and when do I use one versus the other or shall I use both?
Parents Reply
  • Hi,

    After revisiting the issue, it turns out the two libraries are indeed exactly what you need for either static or dynamic linking of pc-ble-driver. (Use the static one if building pc-ble-driver into your application, or the one without "static" in the name for linking dynamically and requiring the .dll.)

    However, the MSVC runtimes are a completely different beast, and from what I now understand that is what you want to link statically as well. That is outside of the scope of pc-ble-driver, but there should be numerous sources for how to do that. Be aware of the pitfalls, however, in particular what might happen if you end up with different versions of the runtime in the same program.

    Regards,
    Terje

Children
  • The MSVC part is easy. I know how to do that, As I said inititially, all the support files can be linked statically - it was the pc-ble-driver that could not, because the library was clearly built using dynamic linking.

    So what you are saying is that I need to reference the static library (very small) and built using static linking and it will work? Trying to build using static linking failed because the pc-ble-driver was built dysnamically and therefore would not build without dynamic linking

  • Hi,

    Right. I think I see now. The issue is that the static library is "static" in the context of pc-ble-driver (no need to provide pc-ble-driver shared library), but not in the context of MSVC runtimes (need to provide those shared libraries.)

    That means you must compile pc-ble-driver from source, instead of using the pre-compiled (differently linked) drivers in the release, and with the proper settings for static linking with the MSVC runtimes.

    Regards,
    Terje

  • I could NOT successfully built my app using the pc-ble-driver static library with VS setting the build options to use static linking. From your statement above (if I understand it correctly) is that the 'static' pc-ble-driver is NOT built using static linking so in order to do what I want to do, I would have to build the library myself using static linking.

    I tried for two weeks when I first received the dongle (many moons ago) to build that library in VS and never succeeded and gave up. I was hoping I could get such a library!

  • Hi,

    I am afraid we do not provide the particular build of the library that you want. We do provide the full source on github and you are free to build it yourself.

    Regards,
    Terje

Related