How to How the Compilation Arch inside Qt



  • I trying to create a generic "About dialog", and I want to show on the label a information about the arch of app compilation (like 32bits, 64bits, x86 or x86_64...)...
    It's possible to make something like this on Qt?
    Thanks all.



  • Anyone?!


  • Moderators

    QSysInfo::WordSize has the word size of the platform.



  • Hello.
    I guess there is one way to achieve what you want. But it may be to difficult. Add new compilation step:

    Get output of GCC

    Parse it

    Put results into some header file

    Include this file into you project

    ???

    PROFIT

    But I realy don't know how to make it, but I didn't ever try.



  • Thanks all.

    QSysInfo::WordSize!



  • To be precise Tobias, QSysInfo::WordSize() gives you the compiled size. Here is some code I use in Windows to find if a 32 bit app is running in an enviroment that supports 64 bit apps:

    @
    int osPointerSize = QSysInfo::WordSize;
    if ( osPointerSize == 32 ) {
    BOOL bIsWow64 = FALSE;
    typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
    LPFN_ISWOW64PROCESS fnIsWow64Process =
    (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle
    (TEXT"kernel32")), "IsWow64Process");
    if ( fnIsWow64Process != NULL ) {
    if ( !fnIsWow64Process(GetCurrentProcess(), &bIsWow64) ) {
    QMessageBox::warning(this, tr("System error"),
    tr("Failed find WOW process"));
    } else if ( bIsWow64 ) {
    osPointerSize = 64;
    }
    }
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.