Solved

Problem use DLL under Borland C++ 5.01

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now