Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4341320
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:28:08+00:00 2026-05-21T11:28:08+00:00

i have an exe loading a dll. i wrote both. i am dllexporting a

  • 0

i have an exe loading a dll. i wrote both.

i am dllexporting a function foo that returns a std::wstring.

all it does is say

std::wstring blah = L”rgjwgfw”;

  return blah.append(L"hey");

in the exe where i import foo, the string is corrupt. as soon as i return from the function where i call foo i get failed assertions. sometimes i get a message saying Windows has triggered a breakpoint in foo.exe. this may be due to a corruption of the heap, etc….. This may also be due to a user pressing f12 while foo.exe has focus. etc….

any idea why this happens? it doesn’t happen if i remove the append line from foo and jsut return the original string, there are no problems.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:28:09+00:00Added an answer on May 21, 2026 at 11:28 am

    This is pretty common problem. You need to link both the DLL and the executable to use the standard library in a DLL. That way they share a common copy of the standard library a common heap. Otherwise, you end up with code in the executable trying to use one heap, and code in the DLL using a separate heap. When you pass almost anything that uses dynamic allocation across the boundary, each assumes the dynamically allocated buffer in the object came from its own heap. Almost any manipulation can not only corrupt the object, but also the entire heap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have EXE and 2 DLL used by this EXE. All binary were compiled
I have a dll mytest.dll that when loaded via LoadLibrary() , returns NULL (and
so I have this project in java that uses a jni .dll i wrote
I have an exe that already creates a csv file. If I save the
I have an EXE that I want to distribute, but I don't want to
I have an EXE file using a DLL file which is using another DLL
I have a .exe assembly and a set of referenced assemblies that I would
I have an exe that is built and placed into a Setup project for
I have a C# application program, let's call it App.exe. It references a DLL
My program have several worker threads that calling a function in a dynamically loaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.