Solved

Problem use DLL under Borland C++ 5.01

Posted on 1998-01-24
2
238 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

685 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