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

  • Home
  • SEARCH
  • 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 a .exe and many plug-in .dll modules that the .exe loads. (I
I have a dll mytest.dll that when loaded via LoadLibrary() , returns NULL (and
I have an exe that I know was written in java. I understand that
I have an .exe I want to start when the Win2k3 server boots. Does
I have a loader.exe with Main() that loads the 'UI' in WPF, the thing
I have a set of .EXE commands. How do I get all those commands
I have a program that runs osql.exe from microsoft sql server tools directory and
I have the following declaration in a Module: Private Declare Function gzopen Lib ZLIB.DLL
I have an external Windows .exe that is actually Java application: Running the .exe
I have an exe that has been wrapped using this method: http://www.kocjan.org/tclmentor/10-tclkits-building-standalone-tcl-binaries.html Is there

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.