09-03-2015 05:53 AM
I will load a dll dynamicaly. On first machine its ok. On second machine i can not load the dll. All path's an names are the same. but the Pointer from function LoadLibrary on the second machine will always be NULL. So I can not work with the DLL. I don't know why I can not load the dll. I need the reason why i can not load the dll.
09-03-2015 06:03 AM
You may try getting some error information using GetLastError, see here
09-03-2015 07:07 AM
One possible reason for not loading is the system is unable to locate the DLL, in which case this MSDN page can be of help: GetLastError suggested by Wolfgang should clarify that.. Are you using the simple name or the full pathname to load the DLL?
09-03-2015 07:13 AM
I used the full pathname with double "\"
The GetLastError get the Value 126. In the internet i found two interpretation A: module not found, but i use the full path the file is found on the explorer and the second interpretation is stack overflow. I must check the system installation.
09-04-2015 05:09 AM
I've found the reason.
The dll, i want to load load internal 5 outher dll's and those dll's want to load also other dll's. Only one dll have a wrong path on one maschine, so i couldn't load all dll's. i used the Process Explorer for searching.
thanks for all
09-09-2015 03:56 AM - edited 09-09-2015 04:03 AM
Usually, DLL dependencies inside DLLs are not defined by path but only by DLL name. This means that the Windows LoadLibrary() function needs to be able to find any such DLL itself. LoadLibrary() has a well defined search order which is best looked up on MSDN:
This is a pretty exhaustive explanation of the search order, which depends on Windows version as well as application specific measures that can be defined using various Windows API calls.
The basic principle is this: if the DLL is not written by yourself and/or you don't know for sure it is self contained (meaning it doesn't have any dependecies; and most DLLs have at least the C runtime dependeny anyhow) you should never just copy a DLL from one system to another but always use the installer from the developer of the DLL which should take care about installing any necessary dependencies in the right location on your actual system.