>We have a COM object with a method that accepts a parameter passed by reference. It populates that parameter with a certain string, dependant upon other factors. It returns the length of the string, or 0 if an error occurs(somewhat similar to that of the GetShortPathName API function).
It's bad design because as you found, COM isn't conducive to passing variables by reference. API functions are different because they usually require that the memory is allocated externally, and the API function just fills the buffer. COM is a completely different beast.
Your COM method should be rewritten to just return the string. If you want to know the length, check it on the client, and if you absolutely must have the value and the length in one return value, return it as a structure-like string that you can parse when you get it back.
Erik Moore
Clientelligence