SDK Basics

From The Foundry MODO SDK wiki
Revision as of 22:14, 10 February 2012 by Shf (Talk | contribs) (COM & Wrappers)

Jump to: navigation, search

COM & Wrappers

The nexus SDK is implemented in COM, but as a C++ developer you mostly don't need to know any of that. Whew! That's a good thing because while COM is relatively simple, dealing with raw COM objects is quite complicated. Fortunately the C++ wrapper classes hide most of the complexity. There are, however, a few concepts that are important to understand at a high level.


The methods that you implement will take the ILxUnknownID datatype as argument for any object. This is the general object type, and can be transformed into specific interfaces based on your needs. This is a COM thing. All objects have multiple interfaces and need to be queried before they can be used. It's a little like dynamic casting in C++, except that the types are known at runtime.

Likewise some of the service methods you will be calling also take ILxUnknownID arguments. Fortunately the wrapper classes can cast to that type implicitly so there is very little that needs to be done on your side to support this. Just know that you can pass a wrapper object and it will be converted to the right type.

Reference Counting

COM objects manage their existence by reference counting. Again, this is mostly handled for you by the wrapper classes. When you initialize a wrapper with an ILxUnknownID object a reference is added, and when the wrapper changes or goes out of scope the reference is released.