I'm aware that for GUI Applications you can use ExtractFilePath(Application.ExeName) to get the full path of where the application is running from.
I'm aware that you can use GetCurrentDir for any application, DLL or exe, to get the full path of where the application\DLL is running from.
But, if you've created a DLL with Freepascal that is called from another propitiatory, commercial, Application that you do not write, what is the best way of calling the full path of where the DLL is being called from in that context? Because, I can't use Application.ExeName in my DLL, because it is not an Application. And if I use GetCurrentDir in my DLL, it gives me the full path of where the commercial application is running from and not the DLL itself, e.g. c:\Program Files\SomeProgram\ProgramName.exe
So for example, lets assume the DLL and the commercial exe are in the following locations :
C:\Users\Gizmo\Documents\UsefulDLLs\MyDLL.dll
C:\Program Files\SomeProgram\TheProgram.exe
I need to call the path of where MyDLL.dll is running from, i.e. I need the return string to be C:\Users\Gizmo\Documents\UsefulDLLs\
I seem to be a bit stuck.