Softimage SDK Programmer's Guide > C++ API Development > Programming with the C++ API >

# Legacy Plug-in Callbacks

Legacy plug-ins expose certain functions so that Softimage can communicate with the implementation library file. These callback functions must have exactly the correct name and parameter signature in order to function properly with Softimage. This section describes the specific signatures for each supported legacy plug-in type (signatures for self-installing plug-ins are described in Callbacks for Self-Installing Plug-ins).

On Linux your functions are automatically exported from your .SO. On Windows you can use the XSIPLUGINCALLBACK macro instead of explicitly exporting them in a DEF file.

Event Callbacks

To use the XSIOnEventCPP callback function to declare your event handler

You need to implement this routine in your DLL or SO file:

    XSIPLUGINCALLBACK XSI::CStatus XSIOnEventCPP( long in_eventID,  XSI::CValueArray& in_args);

Parameter | Description
--- | ---
in_eventID | Event ID to process
in_args | Array of arguments for this specific event

To export your event handler function (on Windows)

To export a function from a DLL, add the XSIPLUGINCALLBACK macro to the function definition. On Windows, this macro resolves to:

    extern "C" __declspec(dllexport)

and on Linux to:

    extern "C"

XSIPLUGINCALLBACK is defined in sicppsdk.h.

Command Callbacks

To use the XSIOnCommandCPP callback function to declare your command handler

You need to implement this function in your DLL or SO file:

    XSIPLUGINCALLBACK XSI::CStatus XSIOnCommandCPP( const XSI::CString& in_name,  XSI::CValueArray& in_args, XSI::CValue& out_value);

Parameter | Description
--- | ---
in_name | Command name.
in_args | Array of arguments for this specific command.
out_value | Return value.

Note

Starting with Softimage, v4.0 custom commands can be fully implemented as self-installing plug-ins which is now the recommended approach (see Custom Commands for detailed instructions on implementing self-installing command plug-ins). However, this approach (often called a v1.0 plug-in type) is still fully supported.

To export your command handler function (on Windows)

To export a function from a DLL, add the XSIPLUGINCALLBACK macro to the function definition. On Windows, this macro resolves to:

    extern "C" __declspec(dllexport)

and on Linux to:

    extern "C"

XSIPLUGINCALLBACK is defined in sicppsdk.h.