<html>
  <head>
    
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">The most obvious differences between
      the CCL and C versions of your code are:<br>
      <br>
      1) The C code sleeps after the calls to mciSendString{A] and the
      CCL code doesn't.<br>
      2) The C code uses (AFAIK, I forget what the TEXT macro does in
      this respect) static, constant strings;<br>
      the CCL code uses stack-allocated, dynamic-extent strings.  (Note
      that you can use <a class="moz-txt-link-freetext" href="CCL:WITH-CSTRS">CCL:WITH-CSTRS</a><br>
      instead of an internal unexported macro, but that isn't really
      relevant.)<br>
      <br>
      If you eliminate those differences and the two versions of the
      code behave differently,<br>
      that might be interesting.  (Certainly more interesting than the
      fact that code that does<br>
      different things behaves differently is.)<br>
      <br>
      In at least some cases, a call to mciSendString returns before the
      operation it invokes completes.  For how<br>
      long after the function returs does the code that manages that
      operation expect the string the function receives as its first
      argument to remain valid ?  Does the fact that a string allocated
      via WITH-CSTRS is deallocated when the WITH-CSTRS form exits (and
      the stack addresses may be reallocated by the REPL or whatever)
      violate assumptions made about that string's lifetime ?<br>
      <br>
      <br>
      On 8/1/13 2:28 PM, Michael Minerva wrote:<br>
    </div>
    <blockquote cite="mid:95538F09-3D03-4014-AA1E-464CF736784A@agentsheets.com" type="cite">We have been trying to track down an issue where we
      experience crashes on some versions of Windows 8 when calling the
      Cocotron method play of NSSound. After digging around in the
      Cocotron source we discovered that the play function ends up
      calling the win32 function mciSendString. 
      <div><br>
      </div>
      <div>Next we tried to remove Cocotron from the equation to see if
        we would still experience the same crash so we created the
        following two tests:</div>
      <div><br>
      </div>
      <div>First, we try to open and play an MP3 file by making an
        external-call to mcsSendStringA:</div>
      <div><br>
      </div>
      <div>
        <div>(<a class="moz-txt-link-freetext" href="ccl::with-cstr">ccl::with-cstr</a> (cstr  "open C:<a moz-do-not-send="true" href="smb://boing.mp3">\\boing.mp3</a> type MPEGVideo alias
          0")</div>
        <div>  (<a class="moz-txt-link-freetext" href="ccl::with-cstr">ccl::with-cstr</a> (cstr2  "play 0 from 0")</div>
        <div>    (external-call "mciSendStringA" :address cstr :address
          +null-ptr+ :int 0 :int 0 :<INT>)</div>
        <div>    (external-call "mciSendStringA" :address cstr2 :address
          +null-ptr+ :int 0 :int 0 :<INT>)))</div>
      </div>
      <div><br>
      </div>
      <div>This causes a crash during the call to open the MP3 (the
        first external call) with no errors reported to any of our
        consoles or the Windows event viewer.</div>
      <div><br>
      </div>
      <div>Next we run the same experiment with a wav file and all works
        well and we hear the correct sound:</div>
      <div><br>
      </div>
      <div>
        <div>(<a class="moz-txt-link-freetext" href="ccl::with-cstr">ccl::with-cstr</a> (cstr  "open C:<a moz-do-not-send="true" href="smb://ding.wav">\\ding.wav</a> type waveaudio alias
          0")</div>
        <div>  (<a class="moz-txt-link-freetext" href="ccl::with-cstr">ccl::with-cstr</a> (cstr2  "play 0 from 0")</div>
        <div>  (external-call "mciSendStringA" :address cstr :address
          +null-ptr+ :int 0 :int 0 :<INT>)</div>
        <div>  (external-call "mciSendStringA" :address cstr2 :address
          +null-ptr+ :int 0 :int 0 :<INT>)))</div>
      </div>
      <div><br>
      </div>
      <div>Finally we wrote a little C++ program:</div>
      <div>
        <div style="font-family: 'times new roman', 'new york', times,
          serif; font-size: 13px; "><font size="2"><br>
          </font></div>
        <div><font>#include <Windows.h></font></div>
        <div><font>#include <iostream></font></div>
        <div style="font-family: 'times new roman', 'new york', times,
          serif; font-size: 13px; "><font size="2"><br>
          </font></div>
        <div>int main()</div>
        <div>{</div>
        <div><span class="Apple-tab-span" style="white-space: pre; "> </span>mciSendString(TEXT("open
          C:<a moz-do-not-send="true" href="smb://boing.mp3">\\boing.mp3</a> type
          MPEGVideo alias 0"), NULL, 0, 0);</div>
        <div><span class="Apple-tab-span" style="white-space:pre"> </span>mciSendString(TEXT("play
          0 from 0"), NULL, 0, 0);</div>
        <div><span class="Apple-tab-span" style="white-space: pre; "> </span>Sleep(5000);</div>
        <div>}</div>
      </div>
      <div style="font-family: 'times new roman', 'new york', times,
        serif; font-size: 13px; "><font size="2"><br>
        </font></div>
      <div>This program runs fine (even with the mp3) so it seems that
        the issue does not lie directly with the win32 function. </div>
      <div><br>
      </div>
      <div>If any Windows 8 users could try out our test code with CCL
        and let us know if they experience the same issue that would be
        of great help (I have included the sound files which you need to
        just put at c:\).</div>
      <div><br>
      </div>
      <div>So far we have only been able to reproduce this problem on
        OEM version of Windows 8 (it never seems to happen with Windows
        8 Pro).</div>
      <div><br>
      </div>
      <div>More generally does anyone have any clues about what might
        going on that would cause this to crash with ccl but not from
        C++?</div>
      <div><br>
      </div>
      <div>Thanks a lot,</div>
      <div><br>
      </div>
      <div>--Mike</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      =<br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Openmcl-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a>
<a class="moz-txt-link-freetext" href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a></pre>
    </blockquote>
    <br>
  </body>
</html>