[plt-scheme] MysterX and ImageMagick COM object

From: Anton van Straaten (anton at appsolutions.com)
Date: Thu Jul 24 16:16:12 EDT 2003

> > I agree that it may not be necessary to avoid using a direct
> > call, but it looks as though it would require quite a bit
> > more rearranging of MysterX to make it work this way - the
> > type checking MysterX does on a direct call doesn't handle
> > vararg functions.
> Sure.  I think this should be added in full generality.  Now,
> who's gonna code that up? :-)

I'd be willing to put it on my list, with no particular deadline (an old
professor of mine referred to such a list as a "never-never list").

In the meantime, the patch I provided seems to work perfectly well, at the
cost of going through COM's IDispatch interface instead of calling the
function directly.  It works around a limitation, without breaking anything.

> I think this quote supports the idea that the server actually does
> expect a SAFEARRAY.  IDispatch::Invoke() builds the SAFEARRAY for
> you, if you're using Automation; otherwise, you have roll your own.

Yes, I think you're right.  I was focusing on the IDispatch side of things
and not thinking about what was involved with a direct call.

Supporting direct calls will then require a change in the arg type-checking
loop at the end of checkArgTypesAndCounts, to understand vararg functions.
Things may also need to be set up so that mx_make_direct_call has the info
it needs to package the varargs correctly, at the point where pushOptArgs
and pushSuppliedArgs are called.  A pushVarArgs macro may be needed, to wrap
the variable arguments in their SAFEARRAY.


Posted on the users mailing list.