OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Help Needed

From: Andrew Schetinin (AschetininENTOPIA.COM)
Date: Wed May 05 2004 - 10:55:37 CDT


 
I do not know if it is true or not, but may be, if both EXE and DLL are
compiled to use the same msvcrt.dll library, they will work with the
same allocation tables. I do not want to try it :-)
 
But both theory and practice discourage allocating memory in one module
and freeing it in another module. It is possible to allocate memory in
DLL and free it using some exported function from this DLL. I'd suggest
getting a pre-allocated buffer from EXE and write the data to it. Or,
for strings, BSTRs with SysAllocString() work not bad.
 
Best Regards,
 
Andrew

-----Original Message-----
From: Seshu Madabushi [mailto:SMadabushiISOFT.COM]
Sent: Wednesday, May 05, 2004 6:44 PM
To: DCOMDISCUSS.MICROSOFT.COM
Subject: Re: Help Needed

Another question on the same terms - Exe using a Dll.

I am malloc'ing in the Dll some variables which are passed back to the
exe. My question is can I free the memory allocated in the Dll, in the
exe. At this point, the only solution looks like I have to get the
length of the variable expected from the Dll, malloc it in the exe, then
pass the pointer and copy the values into that pointer.

Is there a better way to do this.

Thanks
Seshu

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html . To unsubscribe,
mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM