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. dynamically linked STL

dynamically linked STL

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++questionannouncement
5 Posts 4 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.
  • V Offline
    V Offline
    vikramlinux
    wrote on last edited by
    #1

    HI all, Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense. Please correct me if I am wrong. The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error. Please help. ~ Vikram S

    CPalliniC E M 3 Replies Last reply
    0
    • V vikramlinux

      HI all, Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense. Please correct me if I am wrong. The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error. Please help. ~ Vikram S

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      vikrams wrote:

      Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense.

      Right.

      vikrams wrote:

      The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error.

      :confused: I don't get you here: using a static library (so, basically a collection of functions and/or classes in executable format) should have nothing to do with such an error... :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      V 1 Reply Last reply
      0
      • V vikramlinux

        HI all, Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense. Please correct me if I am wrong. The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error. Please help. ~ Vikram S

        E Offline
        E Offline
        Eugen Podsypalnikov
        wrote on last edited by
        #3

        But... ... the template sources (the only used) must be compiled, there is no any template LIB/DLL in the nature... :)

        virtual void BeHappy() = 0;

        1 Reply Last reply
        0
        • CPalliniC CPallini

          vikrams wrote:

          Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense.

          Right.

          vikrams wrote:

          The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error.

          :confused: I don't get you here: using a static library (so, basically a collection of functions and/or classes in executable format) should have nothing to do with such an error... :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          V Offline
          V Offline
          vikramlinux
          wrote on last edited by
          #4

          so if my static library is compiled with newer version of compiler and my client uses it in its code which is compiled with older version of compiler. Things should work fine? This problem statment utimately boils down to 1) I have one static libray say "A" build with Compiler 2.0, uses STL 2) I have another static library "B" compiled with Compiler 1.0 uses STL If I try to make my client application with Compiler 1.0. using both the libraries(A and B), will it work? Does linker allows me to link two libraries carrying different STL instances? Can there be ambiguities or optimization issues? ~ Vikram S

          1 Reply Last reply
          0
          • V vikramlinux

            HI all, Is it possible to link STL dynamically to my application? For me it is a bit confusing as template libraries are shipped as source. Hence making those in a DLL does not make sense. Please correct me if I am wrong. The real problem here is I have a static library produced my latest compiler which uses STL. Now If my client want to use it this library with compiler of lower version, it gives STL class undefined error. Please help. ~ Vikram S

            M Offline
            M Offline
            Moak
            wrote on last edited by
            #5

            vikrams wrote:

            Is it possible to link STL dynamically to my application?

            No, because you should not use STL across library boundaries...without really knowing what you do. First of all is STL not a binary compatible interface, you must compile with exactly the same STL version in all modules/libraries/DLLs. There is probably no linker warning/error if you try otherwise. Secondly allocating memory in one module's heap and deallocating in another will fail, if you do not provide special allocators. In short, there is no easy way to use STL in exported interfaces. Some more background: The Old New Thing: Allocating and freeing memory across module boundaries[^] Hope it helps! :) /M

            Webchat in Europe :java: Now with 26% more Twitter

            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