IVsaSite.GetGlobalInstance Method
Gets a reference to a global item, such as the host-provided application object.
public: Object* GetGlobalInstance(
String* Name
);
public object GetGlobalInstance(
string Name
);
MustOverride Public Function GetGlobalInstance( _
ByVal Name As String _
) As Object
Parameters
- name
The specified name of the global object to retrieve.
Return Value
Returns a reference to the global object.
Remarks
Exposing global objects in Script for the .NET Framework is a relatively simple process.
The host adds global items to the engine by creating an IVsaGlobalItem object, specifying the name and type of the global object.
With this information, the engine is able to compile the code items to bind against the global object.
When the host calls the IVsaEngine.Run method, the engine calls back on the IVsaSite.GetGlobalInstance method to pull a host-provided instance of the named global item into the script engine.
The following table shows the exceptions that the GetGlobalInstance method can throw.
Exception Type |
Condition |
---|---|
GlobalInstanceInvalid |
The named global instance does not exist. |
CallbackUnexpected |
The host was not expecting a call at this time. |