[racket] mysterx-mzlib<->ffi/com

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Aug 27 10:50:21 EDT 2012

Here's a replacement for lines 621 through 627 (while also keeping the
change to line 474) that should fix that problem:

	 (define cleanup (box null))
         (define csi (parameterize ([current-cleanup cleanup])
		       (make-COSERVERINFO 0 machine #f 0)))
         (define mqi (make-MULTI_QI IID_IUnknown #f 0))
         (define unknown
	   (dynamic-wind
	    void
	    (lambda ()
	      (CoCreateInstanceEx clsid #f CLSCTX_REMOTE_SERVER 
                                  (and machine csi) 1 mqi))
	    (lambda ()
	      (for ([proc (in-list (unbox cleanup))]) (proc)))))

Thanks for your help and patience.

At Mon, 27 Aug 2012 10:11:52 +0200, heraklea at gmx.de wrote:
> Hello,
> 
> I make the changes and run my code:
> ..\..\Program Files\Racket\collects\ffi\unsafe\com.rkt:626:11: SysFreeString: 
> given value does not fit primitive C type
>   C type: _pointer
>   given value: "PC-MYPCXYZ"
> -----[BEGIN_LOG]:
> GC[0:min] @ 362,186K(+6,773K)[+29,296K]; free 21,326K(-32,910K) 47ms @ 17269
> GC[0:MAJ] @ 374,471K(+6,968K)[+29,328K]; free 118,397K(-31,677K) 515ms @ 17487
> GC[0:MAJ] @ 289,540K(+5,947K)[+29,268K]; free 65,222K(-31,174K) 515ms @ 18158
> GC[0:min] @ 257,574K(+4,441K)[+28,988K]; free 28,311K(-32,727K) 31ms @ 18813
> GC[0:min] @ 262,475K(+4,596K)[+28,988K]; free 22,892K(-32,556K) 63ms @ 19000
> GC[0:min] @ 272,674K(+4,573K)[+28,988K]; free 26,035K(-32,627K) 31ms @ 19250
> GC[0:min] @ 279,405K(+4,562K)[+28,988K]; free 24,151K(-32,663K) 47ms @ 19531
> GC[0:min] @ 288,021K(+4,458K)[+28,988K]; free 21,814K(-32,758K) 47ms @ 19749
> GC[0:min] @ 299,260K(+4,547K)[+28,988K]; free 24,999K(-32,743K) 47ms @ 19983
> GC[0:min] @ 308,197K(+4,762K)[+28,988K]; free 26,789K(-32,677K) 47ms @ 20186
> result kind: 8
> GC[0:min] @ 322,861K(+4,882K)[+29,228K]; free 40,121K(-32,761K) 47ms @ 20482
> GC[0:min] @ 315,634K(+4,877K)[+29,240K]; free 32,435K(-32,755K) 15ms @ 20904
> -----[END_LOG]
> 
> Yours,
> -------- Original-Nachricht --------
> > Datum: Sun, 26 Aug 2012 18:26:18 -0600
> > Von: Matthew Flatt <mflatt at cs.utah.edu>
> > An: heraklea at gmx.de
> > CC: racket <users at racket-lang.org>
> > Betreff: Re: [racket] mysterx-mzlib<->ffi/com
> 
> > Thanks! I see that I was on the wrong track...
> > 
> > Does it help to change lines (which I think I've typed correctly this
> > time) as follows?
> > 
> > Line 474, add `/null':
> > 
> >                            [pItf _IUnknown-pointer/null]
> > 
> > Line 621, remove `cast':
> > 
> >          (define csi (make-COSERVERINFO 0 machine #f 0))
> > 
> > 
> > At Mon, 27 Aug 2012 00:22:05 +0200, heraklea at gmx.de wrote:
> > > Hello I add the line you give me in line 1884 not 1184. And the result
> > is :
> > > 
> > > GC[0:min] @ 318,206K(+5,505K)[+29,792K]; free 30,408K(-32,776K) 94ms @
> > 99918
> > > GC[0:min] @ 321,353K(+5,558K)[+29,820K]; free 19,753K(-32,809K) 156ms @
> > 100402
> > > GC[0:min] @ 334,807K(+5,736K)[+29,824K]; free 27,834K(-32,634K) 109ms @
> > 100979
> > > GC[0:min] @ 340,728K(+5,895K)[+29,836K]; free 29,018K(-32,538K) 93ms @
> > 101463
> > > GC[0:min] @ 345,239K(+5,928K)[+29,840K]; free 24,421K(-32,485K) 140ms @
> > 101915
> > > GC[0:min] @ 354,841K(+6,054K)[+29,840K]; free 27,171K(-32,419K) 109ms @
> > 102570
> > > GC[0:min] @ 361,132K(+6,163K)[+29,840K]; free 25,335K(-32,247K) 140ms @
> > 103288
> > > GC[0:min] @ 368,611K(+5,724K)[+29,840K]; free 23,676K(-32,764K) 110ms @
> > 103927
> > > GC[0:min] @ 377,702K(+5,721K)[+29,840K]; free 20,144K(-32,816K) 141ms @
> > 104442
> > > GC[0:min] @ 391,668K(+6,411K)[+29,840K]; free 30,161K(-32,145K) 125ms @
> > 105160
> > > GC[0:min] @ 395,581K(+6,146K)[+29,844K]; free 29,039K(-32,431K) 125ms @
> > 105612
> > > result kind: 8
> > > 
> > > Yours,
> > > -------- Original-Nachricht --------
> > > > Datum: Thu, 16 Aug 2012 12:14:17 -0600
> > > > Von: Matthew Flatt <mflatt at cs.utah.edu>
> > > > An: heraklea at gmx.de
> > > > Betreff: Re: [racket] mysterx-mzlib<->ffi/com
> > > 
> > > > It's difficult for me to debug without having the COM class installed,
> > > > so maybe you can help me a little.
> > > > 
> > > > In your Racket installation, the file
> > > > 
> > > >  collects/ffi/unsafe/com.rkt
> > > > 
> > > > has on line 1184
> > > > 
> > > >          [(zero? hr)
> > > >           (begin0
> > > >            (if method-result
> > > >                (variant-to-scheme method-result)
> > > >                (void))
> > > >            (for ([proc (in-list cleanups)]) (proc)))]
> > > > 
> > > > Could you add
> > > > 
> > > >  (log-error (format "result kind: ~s" (VARIANT-vt method-result)))
> > > > 
> > > > there, so that the `cond' clause is
> > > > 
> > > >          [(zero? hr)
> > > >           (log-error (format "result kind: ~s" (VARIANT-vt
> > > > method-result)))
> > > >           (begin0
> > > >            (if method-result
> > > >                (variant-to-scheme method-result)
> > > >                (void))
> > > >            (for ([proc (in-list cleanups)]) (proc)))]
> > > > 
> > > > and let me know what the logged result kind is? (In DrRacket, there's
> > > > an option to show the log.)
> > > > 
> > > > Thanks!
> > > > 
> > > > At Wed, 15 Aug 2012 18:03:48 +0200, heraklea at gmx.de wrote:
> > > > > The Signature of the method is
> > > > > 
> > > > > TakeCurrentServer(BSTR *p_param)
> > > > > 
> > > > > in the body
> > > > > ...
> > > > > *p_param = MySrv.AllocSysString();
> > > > > return S_OK;
> > > > > ...
> > > > > 
> > > > > Yours,
> > > > > ____________________
> > > > >   Racket Users list:
> > > > >   http://lists.racket-lang.org/users
> > > ____________________
> > >   Racket Users list:
> > >   http://lists.racket-lang.org/users


Posted on the users mailing list.