Keith
You wrote in message news:b9ns90$4ua$
[hidden email]...
> Problem solved - I needed to convert the string answer to a BSTR
Be careful, that probably isn't right assuming that you are both
implementing and calling this interface (?), although you may "get away with
it". A BSTR would not be the right thing to return for the IDL you quoted.
Returning C strings through a COM interface is pretty unusual, not least
because it is tricky to get right, but also because it is not automation
compatible and AFAIK, not supported by VB clients. Are you sure the IDL is
right? If it has been decoded from a type library then sometimes it may not
be due to limitations in the type-library format, or a bug in the
type-library analyzer. You can eliminate the latter by comparing Dolphin's
IDL with that generated by OLEVIEW.
Anyway the IDL implies that a char** string is expected, i.e. a single-byte
ASCII string allocated by the callee from the COM task heap that will be
free'd by the caller (or the RPC layers if the caller and callee are in
separate processes). A BSTR is a type of Unicode (double-byte) string which
will be null-terminated, but which will also have a 32-bit length count in
the 4-bytes before the string data. BSTRs should always be allocated and
deallocated through SysAllocString/SysFreeString and friends. It so happens
that these use the standard COM task heap (i.e. the default process heap),
and so you will probably find it does not fault, but there will be a leak of
the four-bytes.
Regards
Blair