[plt-scheme] MysterX in v204
The version of MysterX released with PLT Scheme v204
has a rather large change, which was not mentioned in the
release announcement. When possible, it uses
direct COM interfaces rather than calling IDispatch::Invoke
(COM Automation). When making a direct method call, MysterX
extracts a C function pointer to the method entry point, sets
up a stack frame, and calls through the function pointer.
Existing MysterX code should work without change.
The code to make all this happen involves inline assembly,
and is rather delicate (which is why I hadn't done it
until now). As usual for COM, the Microsoft documentation
is fairly opaque, and one often has to guess how things are
really supposed to work. Unfortunately, the current MysterX
test suite is not exhaustive. While I've tested the code with a
number of COM servers, one should be on the lookout for any
problems.
The benefit of using direct calls is speed. For in-process
COM servers, method calls seem to be about twice as fast. For
out-of-process servers, there is still some benefit. For
an Excel method I tried, calls took about 20-25% less time.
-- Paul