DLL causing application error
Posted on 1999-07-15
I developed a DLL using VC++. Since I need CString to do string manipulation, I did this by using the MFC Application DLL example that the wizard creates, added a few functions of my own, then export the functions that needed to be exported.
When I try this DLL by calling it in a VB test program (what it was written for), I could call it over and over again without any problem. But as soon as I use it in a VB program with DataEnvironment queries, after a few times of calling, I get an application error message:
The instruction at "0x77f64765" referenced memory at "0x31343534". The memory could not be "written".
Or something similar. When I don't call the DLL I don't have any problem running that program. That's why I suspect my DLL is causing it. But I don't know how to debug it.
In my DLL I'm not doing any memory allocation. I pass a string to it, and write a string value to the location provided to it. The header looks something like this:
int __stdcall EncryptText(LPSTR inStr, LPSTR *poutStr)
*poutStr points to a VB string with 255 spaces. I'm not re-allocating spaces but just writing the result to that space. My believe is VB will clean it up probably.
Can someone please tell me how to go about debugging it? Thanks a lot.