Version 5 (modified by Nicolas, 10 years ago) (diff)


Dynamic library issues

Applications can use dynamic libraries; just include them in the multi-file application.

A problem arises if you support multiple platforms and the libraries for the different platforms have the same name. In BOINC, if files are called the same, they must be the same file.

For example, suppose you support both Win32 and Win64, and you use a DLL "vcomp90.dll" that has 32- and 64-bit versions. If you install the 32-bit app first, it will end up trying to link the 64-bit library, and will crash.

One solution is to give the libraries different names, e.g. vcomp90_32.dll and vcomp90_64.dll. However, this requires changing your application (or build system) to look for the DLL under that different name.

A second solution, which doesn't require changing Makefiles or VS project files, is to give the libraries different physical names but the same logical name. Do this as follows:

  • In the 32-bit app, call the file vcomp90.dll=vcomp90_v1.0_32bit.dll. This will be copied as "vcomp90_v1.0_32bit.dll" to the download directory, and used as "vcomp90.dll" on the client.
  • Then, add another file called vcomp90.dll=vcomp90_v1.0_32bit.dll.file_ref_info containing just:

copy_file will ensure the file is copied to vcomp90.dll, instead of linked, since Windows obviously won't understand BOINC soft links when trying to find the DLL.

It's a good idea to add a version number to the physical name, in case you ever need to modify the file. This also means that even if you don't use multiple platforms, it's still useful to use this technique, using just a version number and no platform name.