Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Including MASM .asm file



  • Hi,

    I'm trying to create a QT project which links to a .lib created in Visual Studio. That library has a reference to '_alldiv', which seems to be provided by lldiv.asm (in the VS redistributable package). That asm file looks like a file MASM would understand.
    How can I include that asm file in my project so that the reference for the library gets satisfied when linking the whole project?

    Thanks in advance.

    Kind regards,

    Remco Poelstra


  • Moderators

    @remcopoelstra
    did you try to add it to SOURCES like any other cpp file?


  • Qt Champions 2019

    @remcopoelstra So, you link against an already built library? Then why does it need an assembler file?



  • @raven-worx Adding it to the SOURCES gives the following warning/error:

    :-1: warning: ..\FUM\lldiv.asm: linker input file unused because linking not done
    :-1: error: error: debug/lldiv.o: No such file or directory

    Adding it to LIBS instead gives an 'file format not recognized' error.

    @jsulm I don't know. Probably the provider of the lib doesn't know either. I asked them for another version, but they are most likely going to respond with 'use Visual Studio'.


  • Moderators

    @remcopoelstra
    ok.
    i haven't tried it, but add this to your .pro file:

    win32:msvc {
        my_asm.output  = ${OBJECTS_DIR}/${QMAKE_FILE_BASE}.obj
        my_asm.variable_out = OBJECTS
        my_asm.input = ASM_FILES
    
        !contains(QMAKE_TARGET.arch, x86_64) {
            my_asm.commands = ml /c /Fo${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
        } else {
            my_asm.commands = ml64 /c /Fo${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
        }
    
        QMAKE_EXTRA_COMPILERS += my_asm
    }
    

    Then all you need to do is ASM_FILES += path/to/file.asm

    Hope it works.



  • @raven-worx Thanks for the suggestion. I couldn't get it to work though. It seems this whole part gets ignored as I see no related output in the compile output window.
    I did however notice that there are a lot of these errors in that window:
    Warning: corrupt .drectve at end of def file
    Further Googling showed that the mingw compiler is absolutely not compatible with VS libraries, so it seems I'm on a dead end anyway...


  • Moderators

    @remcopoelstra said in Including MASM .asm file:

    Further Googling showed that the mingw compiler is absolutely not compatible with VS libraries, so it seems I'm on a dead end anyway...

    well ... don't you think that the fact that you are using mingw instead of MSVC would be a valuable information beforehand?!
    You never mentioned mingw... of course MSVC and mingw libs are not compatible. Not even libs compiled with different MSVC versions are compatible.


Log in to reply