Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Compatibility libraries generated by MSVC and minGW
Forum Updated to NodeBB v4.3 + New Features

Compatibility libraries generated by MSVC and minGW

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
6 Posts 6 Posters 5.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vics
    wrote on last edited by A Former User
    #1

    Hi,

    In project I want to use some open source lbraries. It's possible to generate them by Microsoft VC (There are makefiles for MSVC and no makefiles for MinGW).
    Also I need use another library. There are makefile for MinGW.
    Does all these libraries will compatibility at Qt ? Or I need somehow rebuild libs generated by Microsoft VS by MinGW?

    Thanks at advance

    1 Reply Last reply
    0
    • yuvaramY Offline
      yuvaramY Offline
      yuvaram
      wrote on last edited by
      #2

      Hi @Vics
      Qt support as single source and can work on different platforms for its dependent compiler.
      If your project is building in MSVC then your open source libraries also should be compiled in MSVC.

      Yuvaram Aligeti
      Embedded Qt Developer
      : )

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by SGaist
        #3

        Hi,

        To add to @yuvaram, on Windows you can't mix and match libraries compiled with different compilers even if they all use Visual Studio. You have to build everything using the same compiler. Thus if any of your dependencies needs a particular version of VS, you have to stay with it.

        As for the project handling used, you should rather use qmake or cmake or even qbs. That way you'll be able to generate the adequate build system.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • M Offline
          M Offline
          mtrch
          wrote on last edited by
          #4

          Libraries and application, compiled with different compilers can be mixed if the following conditions are met:

          • Library compiled as dynamic link library (DLL)
          • It export only plain C API (no classes, function overloading, etc.)
          • Memory allocated by DLL must be freed by DLL, not by application. Same for other resources such as files.
          • Do not pass CRT handles (for example, FILE* pointer) between DLL and application (WinAPI handles are OK).
          • Prefer cdecl calling convention, when exporting symbols from DLL, other conventions can cause trouble, when using MingGW linker.
          • ??? (maybe, I forgot something :) )
          kshegunovK T 2 Replies Last reply
          2
          • M mtrch

            Libraries and application, compiled with different compilers can be mixed if the following conditions are met:

            • Library compiled as dynamic link library (DLL)
            • It export only plain C API (no classes, function overloading, etc.)
            • Memory allocated by DLL must be freed by DLL, not by application. Same for other resources such as files.
            • Do not pass CRT handles (for example, FILE* pointer) between DLL and application (WinAPI handles are OK).
            • Prefer cdecl calling convention, when exporting symbols from DLL, other conventions can cause trouble, when using MingGW linker.
            • ??? (maybe, I forgot something :) )
            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @mtrch said in Compatibility libraries generated by MSVC and minGW:

            Memory allocated by DLL must be freed by DLL, not by application. Same for other resources such as files.

            This could be relaxed to using the same heap for both binaries, i.e. linking to the same CRT binary.

            Do not pass CRT handles (for example, FILE* pointer) between DLL and application (WinAPI handles are OK).

            I think the above argument holds here too, but I'm not 100% sure.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • M mtrch

              Libraries and application, compiled with different compilers can be mixed if the following conditions are met:

              • Library compiled as dynamic link library (DLL)
              • It export only plain C API (no classes, function overloading, etc.)
              • Memory allocated by DLL must be freed by DLL, not by application. Same for other resources such as files.
              • Do not pass CRT handles (for example, FILE* pointer) between DLL and application (WinAPI handles are OK).
              • Prefer cdecl calling convention, when exporting symbols from DLL, other conventions can cause trouble, when using MingGW linker.
              • ??? (maybe, I forgot something :) )
              T Offline
              T Offline
              Thuan T. Nguyen
              wrote on last edited by
              #6

              @mtrch
              Agree with you, I say because I did practice what you mentioned here.
              Yes, it is workable.
              Best regards,
              Thuan T. Nguyen

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved