Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default DLLs and VBA: Who free's a variant?


"James Scott" wrote in message
om...
Hi,

I have a VC++ DLL function which is returning a variant to VBA. The
variant contains a SAFEARRAY (by ref) allocated by the function which
may in turn contain other variants etc. All this being allocated with
CoTaskMemAlloc..

It works fine, except it looks to me like VBA doesn't deallocate the
structures it's getting back when it's finished with them. I've seen
some rumours about IDL's and [in] [out] parameters being the way to do
this, anyone got any ideas?

James


Passing data BYREF means all you are doing is passing a pointer
to the place in memory the data is stored.

If the dll is an inprocess server , that is its only called as a result
of your programme then it will be released when you set the
ActiveX Object to nothing. If its an out of process server i.e.
another programme you are attaching to then its for that programme
to do the clean out.

In the C# servers I am currently developing I definitely use
IN and OUT rather than BYREF but there is a an overhead
here. When you pass data this way you are creating a copy and
then passing it which for large data sets mau be an issue.

Keith


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variant valiables problem [email protected] Excel Discussion (Misc queries) 0 October 8th 08 10:05 PM
To get a sum for variant currency values [email protected] Excel Discussion (Misc queries) 3 November 24th 07 01:07 PM
How do I assign range to variant and use Mike H[_2_] Excel Discussion (Misc queries) 7 June 7th 07 01:40 AM
DLLs and VBA: Who free's a variant? Rob Bovey Excel Programming 0 August 5th 03 09:26 PM
How do DLLs Work? Tom Ogilvy Excel Programming 1 July 23rd 03 09:57 AM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"