Prior to the C++ API the only way to write compiled C++ code was by using COM to access the Scripting version of the Object Model.
Some existing plug-ins continue to use this method, but in almost all cases new C or C++ development should use the C++ API.
No backward compatibility: As XSI evolves it no longer guarantees binary or source compatibility for COM based plug-ins. However Softimage does its best to avoid changing the scripting interfaces in a way that would cause major havok in existing plug-ins. In most cases only a few source code changes or even a simple recompilation should be enough.
Example: The type of the first argument for X3DObject.AddModel was changed in XSI v5.0. This results in a more compliant scripting API, with better JScript support. As an unavoidable side effect it means that COM code would need to be modified to pass a VARIANT instead of an IDispatch pointer in order to compile and function in XSI v5.0.
1.1 Warning C4278: Type Library is Already Macro
1.2 Error C3867: Function Call Missing Argument List
Some common errors you may see while recompiling your COM plug-ins include:
When you recompile COM API dll for XSI v.6.0 using Visual Studio .NET, you will get an warning like this:
warning C4278: 'GetObject': identifier of typelibrary 'si3dobjectmodel.tlb' is already macro. Please use 'rename' modifier.
In order to resolve this warning, you need to modify where you import si3dobjectmodel.tlb from. Change this import directive:
#import <si3dobjectmodel.tlb>
to this:
#import <si3dobjectmodel.tlb> rename("GetObject", "GetObjectA")
When you recompile COM API dll for XSI v.6.0 using Visual Studio .NET, you might get an error like this:
error C3867: 'SI3DOBJECTMODELLIB::XSIApplication::GetDictionary':function call missing argument list; use '&SI3DOBJECTMODELLIB::XSIApplication::GetDictionary' to create a pointer to member
This is because default values are no longer supported with VS.NET 2005.
The documentation for error C3867 says "This error can also be generated as a result of compiler conformance work that was done for Visual C++ 2005: enhanced pointer-to-member conformance. Code that compiled prior to Visual C++ 2005 will now generate C3867. See Breaking Changes in the Visual C++ 2005 Compiler for more information."
In order to resolve this issue, you just need to specify all the arguments in your code.
In case you use Visual Studio .NET 2003, you may get errors like this:
XXXXXXXXXXXXX.cpp(0) : error C2059: syntax error: 'newline'
XXXXXXXXXXXXX.cpp(0) : fatal error C1903: unable to recover from previous error(s); stopping compilation
In order to resolve this issue, you need to reorder the way you declare #import and #include.
#include <xsi_status.h> needs to be above #import <si3dobjectmodel.tlb> in the code.
Categories: XSISDK