STL String (VC++ 6.0) native code issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sai Kit Tong

    #1

    STL String (VC++ 6.0) native code issue

    I have a native (legacy) library created with Visual Studio 6.0. It utilizes
    STL for its string operation. In addition, most of public members of the
    classes in this library return or use STL string as parameters. The
    implementation for STL seems to change so I fail to using the IJW approach.
    Is there a workaround?


  • Doug Harrison [MVP]

    #2
    Re: STL String (VC++ 6.0) native code issue

    Sai Kit Tong wrote:
    [color=blue]
    >I have a native (legacy) library created with Visual Studio 6.0. It utilizes
    >STL for its string operation. In addition, most of public members of the
    >classes in this library return or use STL string as parameters. The
    >implementati on for STL seems to change so I fail to using the IJW approach.
    >Is there a workaround?[/color]

    Not that I know of. The VC6 and VC.NET implementations of std::string are
    not binary compatible. This is a versioning issue, not an IJW shortcoming.

    --
    Doug Harrison
    Microsoft MVP - Visual C++

    Comment

    • Carl Daniel [VC++ MVP]

      #3
      Re: STL String (VC++ 6.0) native code issue

      Sai Kit Tong wrote:[color=blue]
      > I have a native (legacy) library created with Visual Studio 6.0. It
      > utilizes STL for its string operation. In addition, most of public
      > members of the classes in this library return or use STL string as
      > parameters. The implementation for STL seems to change so I fail to
      > using the IJW approach. Is there a workaround?[/color]

      As Doug mentioned, this is a versioning/binary compatibility issue, not an
      IJW issue.

      One workaround I can think of:

      In VC6, implement a library which wraps your legacy library in a plain 'C'
      API. Compile this wrapper and your legacy library into a DLL using VC6.

      In VC7{.1}, implement a library which wraps the C API in a new C++ wrapper
      that exposes VC7{.1} STL classes. Compile this library with VC7 and link it
      with your program.

      Ugly, but it could be workable, depending on how wide the API to your legacy
      library is.

      -cd


      Comment

      Working...