473,486 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

debug assertion in dbgheap.c when loading dll

Hello
I have a mixed mode c++ dll that i want to use from a c# project.

However, I get an debug assertion when the dll is loaded. The assertion
is in line 1301 in dbgheap.c in the function

extern "C" _CRTIMP size_t __cdecl _msize_dbg

it checks for pUserData not being NULL and pUserData is NULL.

The function is called from

_onexit_t __cdecl __dllonexit

in onexit.c:247 which itself is called by _initterm in my dll module.

the problem seems to be that the parameter pbegin in the __dllonext
points to a NULL value.
The comments in onexit.c say that "void (***pbegin)() - pointer to
variable pointing to the beginning of list of functions to execute on
detach"

I have not defined a function to be called on detach and in fact have
not defined any dll specific function like an entrypoint since normally
the VS Compiler did all the magic itself.

I've created the Project in Visual C++ Express Beta1 by using the
Project Wizard and then added some native c++ files and also implemented
some managed Types. I've created mixed mode dlls in this way before and
it worked fine.

Any suggestions anyone?

Thanks
Ben

--
http://bschwehn.de
Nov 17 '05 #1
3 3709
Hi Ben,
Would you be able to post some repro code for us to debug into the issue.
Thanks.

"Ben Schwehn" wrote:
Hello
I have a mixed mode c++ dll that i want to use from a c# project.

However, I get an debug assertion when the dll is loaded. The assertion
is in line 1301 in dbgheap.c in the function

extern "C" _CRTIMP size_t __cdecl _msize_dbg

it checks for pUserData not being NULL and pUserData is NULL.

The function is called from

_onexit_t __cdecl __dllonexit

in onexit.c:247 which itself is called by _initterm in my dll module.

the problem seems to be that the parameter pbegin in the __dllonext
points to a NULL value.
The comments in onexit.c say that "void (***pbegin)() - pointer to
variable pointing to the beginning of list of functions to execute on
detach"

I have not defined a function to be called on detach and in fact have
not defined any dll specific function like an entrypoint since normally
the VS Compiler did all the magic itself.

I've created the Project in Visual C++ Express Beta1 by using the
Project Wizard and then added some native c++ files and also implemented
some managed Types. I've created mixed mode dlls in this way before and
it worked fine.

Any suggestions anyone?

Thanks
Ben

--
http://bschwehn.de

Nov 17 '05 #2
> Would you be able to post some repro code for us to debug into the issue.

Hello,

I've made two minimal projects that can be downloaded from
http://bschwehn.de/dbgheapassertion.zip (25kb)

I've found that the problem disappears if i don't include any STL header
files (like <sstraam> and <string>), even though I don't actually use
any STL code in the sample project.

I've also found several postings via google groups that mention problems
when using the STL and mixing debug/release dlls but nothing that solved
my problem. I've tried compiling with both /MD and /MDd without success

As I said, I'm using the VC Express Beta 1 and C# Express Beta 1

thanks
Ben
Nov 17 '05 #3
using /INCLUDE:"__DllMainCRTStartup@12" seems to have solved my problem
Nov 17 '05 #4

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

Similar topics

1
12213
by: Kostatus | last post by:
When I close my program and call: delete *iter2; (iter2 being an iterator of a vector which contains pointers to objects) I get a "Debug Assertion Failed!" message (using VC++ 6) with the...
0
1996
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some...
1
3514
by: Eyal | last post by:
Hi, We have an issue with Debug Assertion showing in Release builds in Managed C++! I have created a small managed C++ project that looks like this: #include "stdafx.h" #using <mscorlib.dll>...
2
17579
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application...
4
9367
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve...
5
4679
by: Bruce | last post by:
I am getting a lot of link errors when compiling in the debug build but not release. I am compiling a CLR managed code class library. I believe the link errors are actually being caused by a...
2
5547
by: Pushpa | last post by:
Hi All, This my part of the c++ program using threads in windows : //modified by pushpa struct structExrdDoc { CExrdDoc* spDoc; LPCTSTR sstrFileName;
2
5769
by: longP | last post by:
Hi I have an application which creates a queue, a thread is putting data in the queue using malloc and another thread is getting data from the queue and delete the memory allocated in the first...
0
1846
by: =?Utf-8?B?REx1ZWNr?= | last post by:
I am getting a debug assertion error that reads: Debug Assertion Failed! program E:\program files\internet explorer\iexplore,exe File: dbgheap.c Line: 1252 Expression:...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
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
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.