It looks like you are using C ++ as a COM client, relying on the native COM support of the VC ++ compiler. To make coding “easier” for the client, you used #import to create C ++ shell classes that try to hide all COM data from you, or at least simplify COM data. This way you are not using the COM SDK directly, but using the client-side platform (I think it looks like a lightweight COM-only platform similar to ATL or MFC).
However, your sample code apparently mixes the direct low-level COM SDK ( VARIANT s, BSTR , SysAllocString ) with the #import COM infrastructure ( _variant_t , _bstr_t , XXXXPtr ). COM from C ++ is complicated at first - so in an ideal world, I would suggest getting to know the basics of COM before going too far ahead.
However, if you just want something to work, I would guess this is the version of the #import-style-of-COM version of the VB code that you provided:
_variant_t example1Var; _variant_t example1Var; SIMUL8::S8SimObjectQIPtr example1;
UPDATE:
#import documentation This makes it easier to use COM with C ++, but one more thing to find out ...
Aardvark
source share