How to use IDispatch in plain C to call a COM object

activexccomgccidispatch

I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code.

So my question is how can I use IDispatch in C to create the COM object without having to depend on MFC, .NET, C#, WTL, or ATL. I believe that if I do so I will be able to compile my code without any problem.

Best Answer

There is a great article on CodeProject entitled "COM in plain C".

Here is the link to Part 1.

There is a lot of very good info on working with COM in C in that article and the author's subsequent follow-ups (I think there are 3 or 4 in the series).

Edit:
I was wrong, there are 8 parts!

Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Part 8