Solved

Problem use DLL under Borland C++ 5.01

Posted on 1998-01-24
2
237 Views
Last Modified: 2008-02-26
I build single project with 1 APP and 3 DLL. If I link APP and DLLs with STATIC runtime library I get runtime error in operator new and delete. If I link APP and DLLs with DINAMIC runtime library -- no problem. Why? How correct this problem?
0
Comment
Question by:Nightmare090197
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1178827
answer comming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1178828
I suspect that you have cases where one of the Dll (or EXE) allocates memory with new and another DLL (or EXE)frees it with delete.  If you have static linked libraries this won't work because each Dll and each Exe will have seperate "private" versions of the run-time library and therefore separate heaps for allocating objects.  When one Dll (or EXE) goes to free an object that was allocated by another Dll (or exe) it looks in its own heap and gets "confussed" and you crash.  If you use the Dll version of the runtime library, then there is only one "instance" of the library and therefore only one heap that is shared by the seperate Dlls and EXEs, thus no problem.  Solution--use the Dll runtime library.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Socket Programming (Unix) 8 139
How can i compile this github project?? 2 88
trigs fail! I thought I knew how to do trignometry 3 75
Android development question 2 51
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question