Table of Contents        Previous topic       Next topic       

The Extension Interface->Compulsory Interface Calls->Initialise()

extern "C" LONG Initialise(LONG* pnError, const char* pszPath)

The Initialise() function must always be present in your extension DLL.  It should return a non-zero value to indicate success. A return value of zero will result in the extension being ignored.

The 32 bit value returned is passed to the extension as the parameter nExtensionState for all other interface calls associated with this initial instance of the extension.

pnError is a pointer to the simulators error number.  If this is set to a non-zero value, the simulator will halt after the execution of the current instruction.  Error numbers 1 to 100 are reserved for Crossware.  Negative error numbers will halt the simulator with a message on the status bar.  Positive error numbers will halt the simulator with the message box. The message is Unknown simulation error followed by the error number.

pszPath points to a string which contains the name of the directory in which your program is located.  The string includes the trailing backslash.  You can use this string to contruct a filename in which you can store persistent project specific information about your extension.

The US English spelling Initialize is also recognised.