debug assertion in dbgheap.c when loading dll

B

Ben Schwehn

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
 
G

Guest

Hi Ben,
Would you be able to post some repro code for us to debug into the issue.
Thanks.
 
B

Ben Schwehn

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top