The DLL I built probably uses one or more DLLs. Initially, I thought it was only the “libz” DLL, which I placed next to the .exe, along with my DLL. But that didn’t help - still getting the “module not found” error. Looking at the “external” symbols, using “nm -u”, I found that it references other external symbols as well. But there doesn’t seem to be any information about which libs it expects to find. Without that info in the DLL, the loader can’t load the mising DLLs, of course. But I can’t fix this either, because I don’t even know which DLLs are missing.
I’ve tried placing every DLL the MinGW contains next to the exe, but that isn’t working, either. I’d also have to try to load each of them to see if that helps. Some info about how Xojo’s DLL loader works would be helpful here so that I don’t keep digging in the dark.
For instance, assuming that I declare a function that uses DLL “A”, and if “A” refs DLL “B”, how would I manage to satisfy the loader? I guess the order is important, e.g. if I order them wrong, then the loader will try to load A before B, and will fail at that. So, how do I enforce the correct order? Does the order of the declares define the order by which the loader loads, or is it in reverse, or is it even random? Also, would I have better control if I used soft declares, because I guess that I can control the loading order better by controlling which external function I call first.
Finally, what do I do if I know that DLL B has to be loaded but I don’t know any function I could reference in it? Because , without actually calling a function from my Xojo code, the loader won’t even try to load the DLL.
To solve all this, could I perhaps use some Win32 function to load the suspected secondary DLLs, and would the loader then be happy? If so, which function would I call? I searched on SO, but all the solutions there are for C#, not for the old WinAPI. E.g. this one: http://stackoverflow.com/questions/19728943/dynamically-loading-dll-referencing-other-dlls