C++ / VBA – How to send a COM object from VBA to a C++ DLL via PInvoke

Today I would like to present a quite uncommon scenario, which involves requesting a COM object from VBA and forwarding it through PInvoke to another C++ DLL. The puzzling part is that if we work with managed COM DLLs, everything runs properly, but if we’re using C++ DLLs, Office will crash with an  Access Violation! Here’s some background info. about the…