I wrote a header file which loads a DLL. I want to load the DLL from the directory of the executable, but whenever it searches for the DLL it just searches it's own directory. How do I get the directory of the executable at run-time?
Assuming you're on Windows (mentioned DLLs): GetModuleFileName
1 2 3 4 5 6
TCHAR app_path[MAX_PATH];
::GetModuleFileName(NULL,app_path,MAX_PATH);
// app_path is now the full path + file name of the exe
// trim off the filename to get the path
// etc