Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Usage of Created Dll's with Header Files

Usage of Created Dll's with Header Files

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 657 Views
  • 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
    DzCode
    wrote on last edited by
    #1

    Hi everyone,

    I created a library which only creates one dll file. However, library includes more than 20 thousands of code, and each class is in different h/cpp files.

    For the developer to use my library, they have to include all header files into the project. However they only wanted to include one header.

    For example I have class A, Class B and class C.
    They only want to have the header of class A but not the others.

    Is there any way to do this? Currently they are putting all headers in to the directory of their project.

    JonBJ 1 Reply Last reply
    0
    • D DzCode

      Hi everyone,

      I created a library which only creates one dll file. However, library includes more than 20 thousands of code, and each class is in different h/cpp files.

      For the developer to use my library, they have to include all header files into the project. However they only wanted to include one header.

      For example I have class A, Class B and class C.
      They only want to have the header of class A but not the others.

      Is there any way to do this? Currently they are putting all headers in to the directory of their project.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @DzCode
      For one thing it depends on how the .h files cross reference to each other. If, say, classA.h goes #include "classB.h" you would need both files present to include the first one.

      If you are the author of the DLL you should think about what you actually need to expose to users of your library/DLL. Do you need to expose everything? Do your classes include instances of other classes (bad for including) or do they include pointers to instances to other classes (better for including)? Etc.

      D 2 Replies Last reply
      0
      • JonBJ JonB

        @DzCode
        For one thing it depends on how the .h files cross reference to each other. If, say, classA.h goes #include "classB.h" you would need both files present to include the first one.

        If you are the author of the DLL you should think about what you actually need to expose to users of your library/DLL. Do you need to expose everything? Do your classes include instances of other classes (bad for including) or do they include pointers to instances to other classes (better for including)? Etc.

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

        @JonB It includes both pointer objects and non-pointer objects of other classes.

        Does forward declaration solve this problem?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @DzCode said in Usage of Created Dll's with Header Files:

          Does forward declaration solve this problem?

          Try it out?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • JonBJ JonB

            @DzCode
            For one thing it depends on how the .h files cross reference to each other. If, say, classA.h goes #include "classB.h" you would need both files present to include the first one.

            If you are the author of the DLL you should think about what you actually need to expose to users of your library/DLL. Do you need to expose everything? Do your classes include instances of other classes (bad for including) or do they include pointers to instances to other classes (better for including)? Etc.

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

            @JonB By the way, I have only exposing the one class to the outside world. Only one class has Q_DECL_EXPORT keyword

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DzCode
              wrote on last edited by
              #6

              Forward declaration is the solution

              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