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. templates and libs/dlls

templates and libs/dlls

Scheduled Pinned Locked Moved C / C++ / MFC
wpfquestion
6 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.
  • Z Offline
    Z Offline
    zildjohn01
    wrote on last edited by
    #1

    hi all, i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?

    C 1 Reply Last reply
    0
    • Z zildjohn01

      hi all, i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class. this[^] might help. Cleek | Image Toolkits | Thumbnail maker -- modified at 16:50 Friday 9th September, 2005

      Z 1 Reply Last reply
      0
      • C Chris Losinger

        you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class. this[^] might help. Cleek | Image Toolkits | Thumbnail maker -- modified at 16:50 Friday 9th September, 2005

        Z Offline
        Z Offline
        zildjohn01
        wrote on last edited by
        #3

        thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?

        N C 2 Replies Last reply
        0
        • Z zildjohn01

          thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?

          N Offline
          N Offline
          Nemanja Trifunovic
          wrote on last edited by
          #4

          Shameless self promotion[^]


          My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

          Z 1 Reply Last reply
          0
          • Z zildjohn01

            thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #5

            zildjohn01 wrote: so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? put the template in a .H file and let anyone who wants to use your template #include that .H file. Cleek | Image Toolkits | Thumbnail maker

            1 Reply Last reply
            0
            • N Nemanja Trifunovic

              Shameless self promotion[^]


              My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

              Z Offline
              Z Offline
              zildjohn01
              wrote on last edited by
              #6

              thanks, that link explains why it doesn't work. so, tbe answer is no? oh well, i'll figure something out ;P

              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