CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    3

    STL string class and DLLs

    Hi,

    Im using Visual Studio 6 (SP-5).
    Im trying to do soming very simple using "string" class of the STL.

    I'll try to explain it as clear as possible:


    1. I have a DLL which exports the function: string GetName();

    std::string DLL_EXPIMP GetName()
    {
    return std::string("My Name");
    }


    2. I have an application which uses this function
    int main(int argc, char* argv[])
    {
    std::string Temp = GetName();
    printf("*** %s ***\n", Temp.c_str());
    return 0;
    }

    The problem is that the application crashes on exit - BUT ONLY ON DEBUG MODE.

    Does anybody knows why it is crashing?
    Is this beacuse I don't have the latest version of the STL?
    How can I know my STL version?

    Thank you very much for your help
    Guy Hudara
    Last edited by hudara; March 13th, 2003 at 08:48 AM.
    Hudara

  2. #2
    Join Date
    May 2000
    Location
    Phoenix, AZ [USA]
    Posts
    1,347
    Usually it's because the DLL and EXE are linking with different
    versions of the C-Runtime. You need to go into the Project
    Settings dialog to fix this. I usually wind up using Multi-threaded
    DLL, but I've used others too.

    --Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured