Late-binding and ByRef parameters

VB, VBA, and VBScript pass arguments by reference by default. A subroutine definition can explicitly override the default by specifying that a parameter should be passed by value. This does raise two issues in the face of late-binding: How are arbitrary expressions passed by reference? The answer is that expressions which cannot be the target…

0

Oleview hangs on Vista when run from elevated cmd prompt

Oleview has been hanging and taking up all the CPU when I tried to open a typelib on a Vista machine. I saw http://support.microsoft.com/kb/176938 and tried to follow the recommended solution (regsvr32 iviewers.dll), but that did not fix it either. It turns out the solution is to run oleview from a non-elevated cmd prompt. For example,…

0

Using IReflect to expose a type as IDispatch to COM

The CLR supports marshalling of objects that support the IReflect interface as IDispatch COM objects. Similarly, IExpando gets marshalled as IDispatchEx. Here is a sample of a managed type called ManagedIDispatch which is used from VBScript and used in a late-bound way. VBScript just deals with IDispatch, and under the hoods, the CLR routes the…

4

Tail call performance on x86

MSIL includes the tail. prefix to be used with call instructions (call, callvirt, calli), and also the specialized form jmp. The tail. prefix is a hint that the stack frame of the current method should be popped from the stack before transferring control to the target of the call. This is important for functional languages…

12