Library Path
-
How can I inside a library determine the location of the library on the harddisk?
Using below code determines the application path which in this case is not related to the library path.
@
QString path = QCoreApplication::applicationDirPath();
@Using Windows XP SP3 and Qt 4.7.1.
-
i'm usyng in main.cpp:
@
#ifdef Q_OS_WIN32
QString env = getenv("SYSTEMROOT");
QCoreApplication::addLibraryPath(env+"\system32");
#endif
@ -
Thanks for the reply but not exactly what I need.
Say I develop a library and install it on a WinXP computer at a location unknown to the library itself. The location of the library can be anywhere or the harddisk.
Say an application then loads the library into its memory.
Inside the library, in the constructor of the class MySuperClass I would like to determine the location of the library. How can I do that?
There is no correlation between the location of the application and library.
-
If you need not crossplatform solution u can:
@
//add to header file
extern "C" IMAGE_DOS_HEADER __ImageBase;
#define THIS_MODULE_HINSTANCE reinterpret_cast<HINSTANCE>(&__ImageBase)//Then
::GetModuleFileName(THIS_MODULE_HINSTANCE, szBuffer, MAX_PATH)
@
"token from rsdn.ru":http://www.rsdn.ru/forum/winapi/261670.aspx