Board index » cppbuilder » Import TLB - Errors in Auto-Generated Files

Import TLB - Errors in Auto-Generated Files

I've been receiving the odd error here and there when I 'Import a Type
Library' and 'Install' it on the toolbar.

Mainly, I'm creating my own custom COM components and importing them, so I
don't know if that is my problem, but:

*** When a function wrapper is generated for a function that has an
out-parameter (and retval), it is generated incorrectly and does not compile
correctly. For example, if I created a COM object in builder with a method
such as:

STDMETHOD(GetValue(/*[out,retval]*/ BSTR* value));

The imported wrapper looks like:

  BSTR __fastcall GetValue(BSTR* value/*[out,retval]*/)
    return GetDefaultInterface()->GetValue(value/*[out,retval]*/);

This fails on compile, as GetDefaultInterface returns an HRESULT. I had to
manually go in and CHANGE all of the returns to HRESULTS. ie:

  HRESULT __fastcall GetValue(BSTR* value/*[out,retval]*/)
    return GetDefaultInterface()->GetValue(value/*[out,retval]*/);

Now that I know this, it's just a pain in the ass if I ever change the
interface during development and need to re-import, but I can deal with it.

Why does this occur? Is this a (known?) bug? Did I declare my function wrong

Thanks for the feedback!


** John J. Kroetch
** Software Developer
** SAFLink Corporation
** 780.462.3341 ext. 239


Re:Import TLB - Errors in Auto-Generated Files

This is (in my opinion) a bug in the COM expert.

Re:Import TLB - Errors in Auto-Generated Files

That's what I believed, as well, but I wanted to confirm it so I was sure it
wasn't something *I* was doing. :)


Other Threads