The ability to create Automation controllers for interfaces that derive from IUnknown has been added to CVI (I believe in version 6.0).
You must, however, restrict the set of datatypes that you use inside your interfaces. The datatypes must be ActiveX Automation compatible. All of the typical data types are supported, including BSTRs, integers, doubles, and interfaces derived from IUnknown. If your server has additional custom data types such as structs, you can create a wrapper interface that encloses each struct or custom data type in another interface that exposes the members of the structs as Automation compatible types.
To clarify Chris's response, the Brockshmidt book does describe in detail how to call COM interfaces (of all types) from
C code. Also, although it is a little obfuscated, the example code that Chris referenced in his response does show how to call, from CVI, COM objects with interfaces derived from IUnknown. There are two key points to note when doing this.
1. You must explicitly dereference the vtbl pointer when you call an interface method.
2. You must pass the interface pointer as the first parameter to each method call (even though this does not show up in the interface definition in C++ or in OleView).
A C++ compiler does these two things for you automatically while a C compiler does not. Following is a line from the code that Chris referenced that shows how to do this.
pMyObjClassFactory->lpVtbl->Release ((IClassFactory *)pMyObjClassFactory);
In this example, pMyObjClassFactory is the interface pointer, pMyObjClassFactory->lpVtbl shows the first point I outlined above, and Release ((IClassFactory *)pMyObjClassFactory) shows the second point I outlined above.
I hope this helps.
David Rohacek
National Instruments