By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,502 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,502 IT Pros & Developers. It's quick & easy.

debug assertion in dbgheap.c when loading dll

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
> 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

P: n/a
using /INCLUDE:"__DllMainCRTStartup@12" seems to have solved my problem
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.