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.

Table of contents

Recompiling COM API dll for XSI v.6.0 using Visual Studio .NET 2005

Some common errors you may see while recompiling your COM plug-ins include:

Warning C4278: Type Library is Already Macro

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")

Error C3867: Function Call Missing Argument List

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.

Recompiling COM API dll for XSI v.6.0 using Visual Studio .NET 2003

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.

This page was last modified 13:25, 22 Jun 2007.
This page has been accessed 8352 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy