473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

dll troubles

I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?
Jul 22 '05 #1
5 1556

"LabRat" <er******@lynx.neu.edu> wrote in message
news:4d**************************@posting.google.c om...
I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?


Yours is not a C++ issue, but an issue with the Microsoft
Windows operating system. Ask about this at
comp.os.ms-windows.programmer.win32

Purpose of comp.lang.c++:
http://www.slack.net/~shiva/welcome.txt

-Mike
Jul 22 '05 #2
On 27 May 2004 08:35:26 -0700, er******@lynx.neu.edu (LabRat) wrote:
I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?


This newsgroup only covers standard C++, not platform specific issues.
Try over in microsoft.public.vc.language.

(Off-Topic hint: make sure that the dll and the exe are both compiled
against the Multithreaded DLL version of the runtime library, either
both the debug one, or both the non-debug one - see project
settings->C\C++->Code generation).
--
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Jul 22 '05 #3

"LabRat" <er******@lynx.neu.edu> wrote in message
news:4d**************************@posting.google.c om...
I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?


Its a very common problem, it means your code has a bug in it. But without
seeing any code it really could be almost anything.

Since you are programming Windows you might be advised to ask this on a
Windows programming group, such as news:comp.os.ms-windows.programmer.win32.
Your problem could be a generic C++ one in which case feel free to ask about
it here or it could be something specific to Windows in which case ask on
the above group.

I would advise, if you ask again, to give a teeny bit more information, such
as some of the problems you encountered and some of the code. Without those
absolutely no-one is going to be able to help. Also before asking again try
narrowing down the problem by removing as much code as possible, then post
the remaining code.

john
Jul 22 '05 #4

LabRat,

you have a potential memory corruption problem, and without
knowing much about your application its just about impossible
to help you.

Has this code ever worked - ie, was it working in a static library before ?
hint - you might have problems if something is allocated by the code in the
dll
and deleted by the executable code.

If you are using MFC ( which I guess you are ), there is a CheckHeap()
function
which you can insert at strategic points in your program:

ASSERT( CheckHeap() );

to try to narrow down the problem. You could also use Purify if you have
a license,
although I'd explore the previous function first since it works very fast
and you might get
to the point quicker.

You should be able to trace down the problem by using the VC++ debugger, run
to
the place where the error happens and then look at the stack of calls to see
whats
happening. I suspect you are deleting memory twice, deleting something
which is
not a pointer, deleting something allocated with malloc/calloc, overwriting
a block
of memory and corrupting the heap bookkeeping structures.

dave

"LabRat" <er******@lynx.neu.edu> wrote in message
news:4d**************************@posting.google.c om...
I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?

Jul 22 '05 #5

"LabRat" <er******@lynx.neu.edu> wrote in message
news:4d**************************@posting.google.c om...
I've been working lately to build a dynamic library (in this case, a
win32 dll) and I have encountered huge problems with it. This is my
first real attempt at doing anything like this, so it's been a
learning experience for me. I have gotten the dll to build
completely, but now I'm having a hard time getting the application
using it to run. When I run the executable I've made it generates
runtime errors:

Debug Assertion Failed!
Expression: _CrtIsValidHeapPointer (pUserData)

Is this a common problem? Or do I have a lot more debugging to do?


It can happen if you allocate memory in main program and free it in .dll or
vice versa. .dll has separate heap, you have to delete memory allocated in
dll in context of that dll.

Regards,
Goran
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Darren Dale | last post by:
I love the language. I love the community. My only complaint is that Python for Windows is built with Visual Studio. It is too difficult to build python, or a module, from source. This is what...
0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
3
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select...
4
by: jernej goricki | last post by:
Hy I'm trying to edit a XSLT document, just like I'm editing a XML document : (Im trying to make a new xsl:template tag here ) Dim myXml As New XmlDocument()...
4
by: Edwin G. Castro | last post by:
I want to start a process from a C# application. I also want to redirect standard error to standard output so that I can read output from both streams just like I could from a command line. In...
0
by: Stefan Slapeta | last post by:
Hi all, I've experienced some troubles with message tables and wanted to know if anybody knows a solution for one of them: - If I translate my .mc file into a Unicode .bin file, some of the...
0
by: D'ALMEIDA Jorge | last post by:
Well i'm trying to get the icon of the visibles windows. i'm using: EnumWindows, IsWindowVisible, and SendMessage with the "WM_GETICON" parameter sometimes then SendMessage function return...
0
by: Michal | last post by:
I have troubles with instaling .Net Framework 2.0 (Beta 2 - 2.0.50215). The main instalation went just fine, troubles begin with my attemt to run aspnet_regiss.exe -i. Asp.Net is instaled into IIS...
0
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved...
1
by: Pegasus | last post by:
Good morning, I'm Filippo Battaglia. We're porting Apache STDCXX under Nanodesktop. We are trying to make nd compatible also with C++ and not only with C. Unfortunately, we're finding different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.