Home All Groups Group Topic Archive Search About
Author
12 Mar 2007 10:21 AM
Nicol
Hi,

I created ATL dll in vc++. 
I am referring this dll in .net.
One of the function named "fun1" which i exposed is having BSTR* datatype.
There I am using the stmt like

*retval=SysAllocString(q);

where retval-> of datatype BSTR*
q->of datatype WCHAR*

I referred this dll in my .net web site application.having one button which
in turn call the vc++ dll function "fun1" to generate one random number. so
each button click will generate a random number.
I am generating random number by calling the function "fun1", when i
generated 9 random numbers i am getting exception like "COM-Server threw an
exception".
I am using many char* variable and string concatenation operation in the
above function fun1 whcih i am using to generate the random number. Then i
removed one string copy. No i am getting error when i tried to genearte my
21st random number.

do i have to free any memory when i use char* bstr*. anyway i can't remove
bstr* since it is the out parameter.

And the error is not caught in my vc++ dlll exception code..
I had like

catch(...)
{
DWORD dw = GetLastError();
            char excMsg[80];
            ltoa(dw, excMsg, 10);
            LogMessage(excMsg);
}

The error msg which is supposed to be logged, is not coming to catch i guess.
how to handle general exception in vc++? how to avoid memeory leakage?

Tx in advance...

AddThis Social Bookmark Button