I'm working on an Excel plugin (XLL), which communicates with COM objects. So, I have to marshall between XLOPER and VARIANT. I've got most of this working, but arrays are definitely a pain. I need to support 1- and 2D arrays.
I imagine someone has already had to deal with this before. What's the best way to simplify dealing with VARIANT, SAFEARRAY, and XLOPER (and XLOPER12)?
I had to hand-roll my own marshalling code for this. There were no freely available libs to handle this. XLW is meant for wrapping your entire plugin - this was not an option for me.
In the end, it just took a lot of time, looking through the documentation for xloper and variant, and figuring out how to map them to each other.
For the curious:
arrays in xloper(12):
arrays in variant:
other tips with this marshalling:
boost::numeric_cast
helps with that.