Issue with SysFreeString...
-
Hi, I am having a COM Component and i am accessing the com using VB client. In Com function i am using SysFreeString, i am calling a function inside COM DLL by passing a string argument from vbclient. After usage i am calling SysFreeString inside the com function. The above mentioned functionality works on several machines and fails(VB client crashes) in one machine. I removed the SysFreeString function call from the failing machine, and now it is fine. Can anyone tell why this happens so strangely ? Anyway we need to call SysFreeString to free up the memory. Kindly guide me! :( Advanced Thanks, Ganesha
Thanks a lot
-
Hi, I am having a COM Component and i am accessing the com using VB client. In Com function i am using SysFreeString, i am calling a function inside COM DLL by passing a string argument from vbclient. After usage i am calling SysFreeString inside the com function. The above mentioned functionality works on several machines and fails(VB client crashes) in one machine. I removed the SysFreeString function call from the failing machine, and now it is fine. Can anyone tell why this happens so strangely ? Anyway we need to call SysFreeString to free up the memory. Kindly guide me! :( Advanced Thanks, Ganesha
Thanks a lot
Hi, I can't say why one machine behaves differently, in fact I would say if you can fix the code so it works on all machines you don't need to know. All my VB -> COM was done in Visual Studio 6 and used IDL rather than attribute based which yours may be but the issues should be the same. What IDL attributes are applied to the string being passed, an [in] or [in,out] or possible [retval]? As you are freeing the string in the .dll, I'm assuming its an [in]?
-
Hi, I can't say why one machine behaves differently, in fact I would say if you can fix the code so it works on all machines you don't need to know. All my VB -> COM was done in Visual Studio 6 and used IDL rather than attribute based which yours may be but the issues should be the same. What IDL attributes are applied to the string being passed, an [in] or [in,out] or possible [retval]? As you are freeing the string in the .dll, I'm assuming its an [in]?
Hi, [in], [out], and sometime [out,retval] Advanced Thanks!!!!
Thanks a lot
-
Hi, [in], [out], and sometime [out,retval] Advanced Thanks!!!!
Thanks a lot
That seems right, I think VB passes strings by reference so it has to be [in,out]. As there is an out] part, VB expects a string to be passed back (out) and is probably deleting this according to some garbage collections algorithm - but you've already done it in the dll. I think not deleting it in the .dll is OK here - you would only do this if it were an [in]. You could delete it in the dll but only is you then assign a new string to it for the [out] part - it's this [out] part that VB is expecting and deleting.
-
Hi, I am having a COM Component and i am accessing the com using VB client. In Com function i am using SysFreeString, i am calling a function inside COM DLL by passing a string argument from vbclient. After usage i am calling SysFreeString inside the com function. The above mentioned functionality works on several machines and fails(VB client crashes) in one machine. I removed the SysFreeString function call from the failing machine, and now it is fine. Can anyone tell why this happens so strangely ? Anyway we need to call SysFreeString to free up the memory. Kindly guide me! :( Advanced Thanks, Ganesha
Thanks a lot
After deallocating with sysfreestring, are you providing a new value with sysallocstring ?
GuimaSun www.nexsun.com.br NEXSUN TechZone