Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Compiler Question: Use of MFC : Use Standard Windows Libraries

Compiler Question: Use of MFC : Use Standard Windows Libraries

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
8 Posts 3 Posters 0 Views 1 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.
  • D Offline
    D Offline
    DeepT
    wrote on last edited by
    #1

    I have a basic MFC dialog based app so I am definitely using MFC. The official documentation says, "Non-MFC projects can select Use Standard Windows Libraries to link to various Win32 libraries that are included when you use MFC". The implication is that you could not build / link / run an MFC application if you chose this compiler option, right? However, you can build and run an MFC application with this option. What I want to know is, what is really going on or why does an MFC application work? If I use this option can I be free of MFC DLL dependencies? I have spent some time googling this, but I can't find any answers to this question.

    B 1 Reply Last reply
    0
    • D DeepT

      I have a basic MFC dialog based app so I am definitely using MFC. The official documentation says, "Non-MFC projects can select Use Standard Windows Libraries to link to various Win32 libraries that are included when you use MFC". The implication is that you could not build / link / run an MFC application if you chose this compiler option, right? However, you can build and run an MFC application with this option. What I want to know is, what is really going on or why does an MFC application work? If I use this option can I be free of MFC DLL dependencies? I have spent some time googling this, but I can't find any answers to this question.

      B Offline
      B Offline
      Binu MD
      wrote on last edited by
      #2

      Hi Deep, Your understanding is almost correct. From visual studio project settings we can select 3 options "Use Standard Windows Libraries", "Use MFC in a Static Library"and "Use MFC in a Shared DLL". The first one[Use Standard Windows Libraries] is used when we had an application or a dll that did not require MFC class or framework support. For example a console application or pure c++ libraries or a win32 application or a C application etc. The second and third options are used where we need MFC class or framework support e.g: MFC dialog application, MFC SDI or MDI application or applications using CString etc. The difference between "Use MFC in a Static Library"and "Use MFC in a Shared DLL" is given below in simple sentence. If you need to run your application in another computer that did not had a Visual Studio run time, you should choose static library other wise use shared dll. And you can find more difference between these two from net http://msdn.microsoft.com/en-us/library/1ez7dh12(v=vs.80).aspx[^] http://stackoverflow.com/questions/2652679/regular-dll-using-mfc-shared-vs-mfc-statically-linked[^]

      D 1 Reply Last reply
      0
      • B Binu MD

        Hi Deep, Your understanding is almost correct. From visual studio project settings we can select 3 options "Use Standard Windows Libraries", "Use MFC in a Static Library"and "Use MFC in a Shared DLL". The first one[Use Standard Windows Libraries] is used when we had an application or a dll that did not require MFC class or framework support. For example a console application or pure c++ libraries or a win32 application or a C application etc. The second and third options are used where we need MFC class or framework support e.g: MFC dialog application, MFC SDI or MDI application or applications using CString etc. The difference between "Use MFC in a Static Library"and "Use MFC in a Shared DLL" is given below in simple sentence. If you need to run your application in another computer that did not had a Visual Studio run time, you should choose static library other wise use shared dll. And you can find more difference between these two from net http://msdn.microsoft.com/en-us/library/1ez7dh12(v=vs.80).aspx[^] http://stackoverflow.com/questions/2652679/regular-dll-using-mfc-shared-vs-mfc-statically-linked[^]

        D Offline
        D Offline
        DeepT
        wrote on last edited by
        #3

        If my understanding is correct, then why can I build and run an MFC based Dialog application using the standard windows libraries? I have actually set this application to use the standard libraries and hit build and run and it does. So why does this work?

        L 1 Reply Last reply
        0
        • D DeepT

          If my understanding is correct, then why can I build and run an MFC based Dialog application using the standard windows libraries? I have actually set this application to use the standard libraries and hit build and run and it does. So why does this work?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Because an MFC project will automatically include any dependent MFC libraries.

          speaking as ...

          D 1 Reply Last reply
          0
          • L Lost User

            Because an MFC project will automatically include any dependent MFC libraries.

            speaking as ...

            D Offline
            D Offline
            DeepT
            wrote on last edited by
            #5

            Ok, thanks that explains that. So is this linked version closer to the MFC-Static mode or shared DLL mode?

            L 1 Reply Last reply
            0
            • D DeepT

              Ok, thanks that explains that. So is this linked version closer to the MFC-Static mode or shared DLL mode?

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I think the majority of the standard libraries are DLL's as they are installed by default on all Windows systems.

              speaking as ...

              D 1 Reply Last reply
              0
              • L Lost User

                I think the majority of the standard libraries are DLL's as they are installed by default on all Windows systems.

                speaking as ...

                D Offline
                D Offline
                DeepT
                wrote on last edited by
                #7

                Thanks for all your help. I think I understand now. I would assume an MFC application compiled with Standard Windows Libraries would still be dependent upon various MFC dlls such that the end users machines might still need the VC redistributable package installed, where as the Static MFC linking gets by that requirement. In other words, going with Standard Windows Libraries buys me nothing unless I am genuinely MFC free.

                L 1 Reply Last reply
                0
                • D DeepT

                  Thanks for all your help. I think I understand now. I would assume an MFC application compiled with Standard Windows Libraries would still be dependent upon various MFC dlls such that the end users machines might still need the VC redistributable package installed, where as the Static MFC linking gets by that requirement. In other words, going with Standard Windows Libraries buys me nothing unless I am genuinely MFC free.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Yes, I think that's about it.

                  speaking as ...

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups