Templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • usyra42
    New Member
    • Mar 2007
    • 8

    #1

    Templates

    I need code to export Class Template from DLL and also client application using that Class Template ,using Vc++ MFCDLL or VC++ Win 32 dynamiclinklibr ary for the creation of Dll that includes a Class Template
  • AdrianH
    Recognized Expert Top Contributor
    • Feb 2007
    • 1251

    #2
    Originally posted by usyra42
    I need code to export Class Template from DLL and also client application using that Class Template ,using Vc++ MFCDLL or VC++ Win 32 dynamiclinklibr ary for the creation of Dll that includes a Class Template
    If I understand you right, you cannot do this.

    A template is a C++ construct that is compiled only when required by the rest of the programme. If it is a generic template of type T, it will not generate code for when T is an int, char, char *, long, user defined class ... the list goes on and on. You can only specify concrete classes and functions for export.


    Adrian

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      A template is a compile-time feature. A DLL is a run-time deal. You won't be able to do this.

      Comment

      • AdrianH
        Recognized Expert Top Contributor
        • Feb 2007
        • 1251

        #4
        usyra42, do not double post. Please read the Posting Guidelines at the shown at the beginging of the forum.


        Adrian

        Comment

        • dcollins
          New Member
          • May 2007
          • 4

          #5
          You can however, explicitly instantiate a class template or function, and export that from a static or dynamic library.

          Comment

          • AdrianH
            Recognized Expert Top Contributor
            • Feb 2007
            • 1251

            #6
            Originally posted by dcollins
            You can however, explicitly instantiate a class template or function, and export that from a static or dynamic library.
            Yes, but then it is not really a template at that point. It is a concrete instantiation.


            Adrian

            Comment

            • usyra42
              New Member
              • Mar 2007
              • 8

              #7
              can u please help in this i need some idea how to export templates ..
              Is it possible to export the class templates...
              i need to complete the project ..
              give some idea ...

              Comment

              • AdrianH
                Recognized Expert Top Contributor
                • Feb 2007
                • 1251

                #8
                Originally posted by usyra42
                can u please help in this i need some idea how to export templates ..
                Is it possible to export the class templates...
                i need to complete the project ..
                give some idea ...
                No, it is not possible. Read the other messages in this thread.


                Adrian

                Comment

                Working...