Hi,

Damn I got a quick answer from the ng! Here's why you're getting the error.
Don't create pointers in the main thread and then free them in the DLL,
because they probably don't share the same memory space.

Alex.


----- Original Message -----
From: "Alex Angas" <[EMAIL PROTECTED]>
Newsgroups: microsoft.public.platformsdk.base
Sent: Sunday, October 07, 2001 11:45 PM
Subject: Re: Memory corruption when passing pointers to DLLs


> Hi Scott,
>
> Thanks for replying!
>
> > What are you doing with the pointer?  "according to the debug heap"
> > seems to imply you are allocating in the exe but freeing in the DLL.
> > That's a problem - you could have two different runtime libs with
> > different heap managers.  If you control both the exe and the DLL you
> > can get around this by making sure they both use the same DLL version of
> > the C runtime library.  Otherwise you must free it in the same module
> > where you allocated it.
>
> I control both the EXE and DLL and am using the Debug Single-Thread
runtime
> in the EXE and the Debug Multi-Threaded DLL runtime in the DLL. What
should
> these be?
>
> I think you're right - the pointer is being freed in the DLL. Thank you!!
>
> Alex.
>
>
>


Reply via email to