packaging template classses into libraries (static, dynamic)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    #1

    packaging template classses into libraries (static, dynamic)

    Is it possible to package a template implementation class into a
    library and how it is done (say into a dll or a static one).

    Since template expansion in c++ is static and takes place at compile
    time (unlike csharp), I would like to find out how we can simulate
    that?


    Thank
  • killerfox

    #2
    Re: packaging template classses into libraries (static, dynamic)

    On Oct 18, 11:21 am, puzzlecracker <ironsel2...@gm ail.comwrote:
    Is it possible to package a template implementation class into a
    library and how it is done (say into a dll or a static one).
    >
    Since template expansion in c++ is static and takes place at compile
    time (unlike csharp), I would like to find out how  we can simulate
    that?
    >
    Thank
    I don't think that is possible at all, since libraries are already
    compiled, and just need to be linked, whereas templates need to be
    seen by the compiler to generate the code.

    One thing I can think of is wrapping all your template headers into a
    precompiled header, and include this in your other projects, but other
    than that I don't think its possible.

    -Kf-

    Comment

    • John

      #3
      Re: packaging template classses into libraries (static, dynamic)

      Resources from the authors, creators, innovators, & leaders of technology - home to leading publishers Addison-Wesley Professional, & Sams.

      about exported template classes.

      "killerfox" <killerfox512@g mail.comwrote in message
      news:126da3ea-beba-4f44-9e1b-fb8b302f132b@l6 4g2000hse.googl egroups.com...
      On Oct 18, 11:21 am, puzzlecracker <ironsel2...@gm ail.comwrote:
      Is it possible to package a template implementation class into a
      library and how it is done (say into a dll or a static one).
      >
      Since template expansion in c++ is static and takes place at compile
      time (unlike csharp), I would like to find out how we can simulate
      that?
      >
      Thank
      I don't think that is possible at all, since libraries are already
      compiled, and just need to be linked, whereas templates need to be
      seen by the compiler to generate the code.

      One thing I can think of is wrapping all your template headers into a
      precompiled header, and include this in your other projects, but other
      than that I don't think its possible.

      -Kf-


      Comment

      • Paavo Helde

        #4
        Re: packaging template classses into libraries (static, dynamic)

        puzzlecracker <ironsel2000@gm ail.comkirjutas :
        Is it possible to package a template implementation class into a
        library and how it is done (say into a dll or a static one).
        >
        Since template expansion in c++ is static and takes place at compile
        time (unlike csharp), I would like to find out how we can simulate
        that?
        See http://www.parashift.com/c++-faq-lit...html#faq-35.13

        Paavo

        Comment

        Working...