I imagine this is a common issue, but googling around hasn't presented a solution. I'm just having some trouble loading a library.
The source that I have for the library is utilizing static loading, which is fine. The rest of the libraries I am using are loaded dynamically.
The problem is that my program is now being loaded up as a library (it is a plugin), by a different application (a host). This means that the directory for the HOST executable, is NOT the program directory for my application.
The library that is being statically loaded (just a simple library for font rendering), is inside of my program's directory, and when loading my software as a plugin, it is not found. When I load up my software as a 'standalone' program (without a host), there is no issue.
I was able to resolve the issue by putting the 'missing' library into the folder for the host application, but this is a bad solution.
I was also able to resolve it by providing a direct path to the name of the library, but this is also a bad solution. I do not know where the end user will be installing my software.
Is there any way around this issue without having to rewrite the code to use dynamic loading?
To continue using static loading, must the library be registered? I think that registering this library is too invasive, as other programs may be using a different version of it.
const
ft_lib = 'freetype6.dll'; //here is our problem. I could put a direct path
//here, to fix it, but I will not know this path
//on an end-user's machine
type
FT_Library = Pointer;
function FT_Init_FreeType(out alibrary : FT_Library ) : FT_Error;
cdecl; external ft_lib name 'FT_Init_FreeType';