realbasic-nug
[Top] [All Lists]

Re: accepting inserted cdr discs

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: accepting inserted cdr discs
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Mon, 30 May 2005 13:34:44 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <f40e06d6f8c17b0106756d6fa6670ca6 at juun dot com> <777737eb6614218e299276c6e4e6a2c9 at juun dot com> <a51031c13b4eceb531cca21e0b5b0353 at juun dot com>

On May 30, 2005, at 2:49 AM, Philip George wrote:

issue resolved by switching build type to Mach-O and removing the "Lib" suffix from each of the declares:

  #if TargetMachO
    dim devices as integer
Declare Function DRCopyDeviceArray Lib "DiscRecording" () as integer Declare Function CFArrayGetCount Lib "CoreFoundation" (devarray as integer) as integer Declare Function CFArrayGetValueAtIndex Lib "CoreFoundation" (devarray as integer, i as integer) as integer Declare Function DRDeviceAcquireExclusiveAccess Lib "DiscRecording" (thedev as integer) as integer
    devices = DRCopyDeviceArray()
    if CFArrayGetCount(devices) > 0 then
if DRDeviceAcquireExclusiveAccess(CFArrayGetValueAtIndex(devices, 0)) = 0 then
        MsgBox "EXCLUSIVE ACCESS TO CD/DVD BURNER ACQUIRED"
      else
        MsgBox "PROBLEM ACQUIRING EXCLUSIVE ACCESS TO CD/DVD BURNER"
      end
    else
      MsgBox "NO CD/DVD BURNER FOUND"
    end
  #endif


by the way, does this look leaky? how do i clean up after i'm done with all the stuff allocated on the heap (1 CFArray and 1 or more DRDevices)? ...or does rb take care of this for me?

REALbasic most certainly does not take care of it for you. You need to release the reference returned by DRCopyDeviceArray when you're finished with it using the Core Foundation function CFRelease. My book on declares at <http://www.quantum-meruit.com/rb/> has a chapter on Core Foundation; it contains a discussion of memory management. As for the DR functions, you should read the header files to see if any guidance is provided.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>